Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Adding series dynamically to igDataChart and assigning data
posted

Hi,

I need to show several data series in one igDataChart (mostly line charts). The number of series shown can vary, so I need to add or remove data series dynamically (as well as adjusting the legend) at runtime.

This is an example of my data (whereas the number of Series can vary):

var data = [{"Series":1,"X":0.0,"Y":10.0},
{"Series":1,"X":1.0,"Y":9.0},
{"Series":1,"X":2.0,"Y":8.5},
{"Series":1,"X":3.0,"Y":8.0},
{"Series":1,"X":4.0,"Y":7.75},
{"Series":1,"X":5.0,"Y":6.0},
{"Series":1,"X":6.0,"Y":5.5},
{"Series":1,"X":7.0,"Y":5.3},
{"Series":1,"X":8.0,"Y":5.0},
{"Series":2,"X":1.0,"Y":15.0},
{"Series":2,"X":2.0,"Y":14.75},
{"Series":2,"X":3.0,"Y":14.5},
{"Series":2,"X":4.0,"Y":14.25},
{"Series":2,"X":5.0,"Y":13.75},
{"Series":2,"X":6.0,"Y":14.0},
{"Series":2,"X":7.0,"Y":13.5},
{"Series":2,"X":8.0,"Y":13.0},
{"Series":2,"X":9.0,"Y":13.75}];


Based on the High Volume Example (https://www.igniteui.com/data-chart/binding-high-volume-data), I failed to add multiple dataSerires.

How do I create dynamically dataSeries for the igDatachart and how do I assign the data dynamically the corresping dataseries? I couldn't find any related examples. 

Kind regards.

--

edit 2020-03-26:

Mistake in embedded code window removed