Does anyone work with Infragistics UltraChart? I’m trying to bind a DataTable with elevation monitor data to a line graph in a Windows form.
As you can see from the following code, I have the DataSet and DataTable defined, and have started setting up the properties of the chart, but I’m not sure how to tie the DataTable table to the XYDataPointCollection series in the chart. Basically I want to be able to graph a line from two fields in the data table: “dateTime” (x-axis) and “gwElevation” (y-axis) for a specified date range.
}
GroundwaterMonitorDataSet gwMonDataSet = new GroundwaterMonitorDataSet();
DataTable gwMonDataTable = new DataTable();
gwMonDataTable = gwMonDataSet.Tables.Add(“P-14-01_Data”);
this.chartGwData.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.LineChart;
Infragistics.UltraChart.Data.Series.XYDataPointCollection gwMonSeries = new Infragistics.UltraChart.Data.Series.XYDataPointCollection();
chartGwData.LineChart.DrawStyle = Infragistics.UltraChart.Shared.Styles.LineDrawStyle.Solid;
chartGwData.LineChart.StartStyle = Infragistics.UltraChart.Shared.Styles.LineCapStyle.Round;
chartGwData.LineChart.EndStyle = Infragistics.UltraChart.Shared.Styles.LineCapStyle.Flat;
chartGwData.LineChart.NullHandling = Infragistics.UltraChart.Shared.Styles.NullHandling.DontPlot;
chartGwData.LineChart.Thickness = 3;
this.chartGwData.DataSource = gwMonDataTable;
this.chartGwData.DataBind();
}
Thanks for any help.
Well I finally figured it out on my own:
First an EnumerableRowCollection must be created. I created one using a linq query which read from a table in my DataSet:
Then I create a NumericTimeSeries, which is populated using a foreach loop:
Now the NumericTimeSeries is ready to be added to the UltraChart: