There are different ways about how the data of a Infragistics Linechart can be initialized. However, I would like to use its Property 'DataSource' and format the data before, since I already use this for other charts too.
So I would prefer this way:
UltraChart1.DataSource = myDataSource
Against this (Whole example with NumericTimeSeries is here)
Dim series1 As New NumericTimeSeries series1.Label = "Series1" series1.Points.Add(New NumericTimeDataPoint(DateTime.Now.AddMonths(-4), 12346, "Januar", True)) series1.Points.Add(New NumericTimeDataPoint(DateTime.Now.AddMonths(-3), 10000, "Februar", True)) series1.Points.Add(New NumericTimeDataPoint(DateTime.Now.AddMonths(-2), 14000, "März", True)) series1.Points.Add(New NumericTimeDataPoint(DateTime.Now.AddMonths(-1), 18000, "April", True)) series1.Points.Add(New NumericTimeDataPoint(DateTime.Now.AddMonths(10), 800, "Mai", True)) Dim series2 As New NumericTimeSeries series2.Label = "Series2" series2.Points.Add(New NumericTimeDataPoint(DateTime.Now.AddMonths(-8), 500, "Januar", True)) series2.Points.Add(New NumericTimeDataPoint(DateTime.Now.AddMonths(-6), 350, "Februar", True)) series2.Points.Add(New NumericTimeDataPoint(DateTime.Now.AddMonths(-4), 600, "März", True)) series2.Points.Add(New NumericTimeDataPoint(DateTime.Now.AddMonths(-2), 800, "April", True)) series2.Points.Add(New NumericTimeDataPoint(DateTime.Now.AddMonths(10), 800, "Mai", True)) UltraChart1.Series.Add(series1) UltraChart1.Series.Add(series2)
However, my question is of how to format the DataSource, that it actually shows up more than one series.
No matter what I try, I'm only getting one Series in the Linechart.
The result should look something like this
We are using an abstract of a datatable, which works fine for the other ChartTypes (PieChart, BarChart, etc.). A good example of how to achieve this, would really be appreciated.
Thank you very much for taking the time and for being so quick Georgi! That sample was perfect to get me on the right track.
Hello Fred,
Yes, It is possible. I create a new sample for you. Please take a look at the attached sample and if you have any questions, feel free to write me
Regards
Hello Georgi,
Is it possible to add toggling of series/lines as you did in the CompositeChart.zip example when binding straight to a datatable without explicitly creating series?
For example:
DataTable dt = new DataTable();dt.Columns.Add(New DataColumn("DateField", typeof(System.DateTime)));dt.Columns.Add(New DataColumn("SeriesField1", typeof(System.Decimal)));dt.Columns.Add(New DataColumn("SeriesField2", typeof(System.Decimal))); ...Add data rows to table//ultraChart1 is a LineChart ultraChart1.DataSource = dt;ultraChart1.DataBind();I'd like to be able to do something like the treeview in your sample to hide the line that corresponds to a particular SeriesFieldX column. Is there a way to do that without explicitly creating the NumericSeries in code and using them? When I look at the UltraChart in debug there are 0 series so I don't see how.
Thanks in advance for your assistance!
Thanks for the feedback. Let me know if you have any further questions.
Thank you, that helped me a lot.