Hi,
I have multiple data series bound to igDataChart as follows:
@(Html.Infragistics().DataChart(Model.Data) .Axes((axes) => { axes.NumericX("xAxis").Stroke("Black").StrokeThickness(4).MajorStroke("Whitesmoke"); axes.NumericY("yAxis").Stroke("Black").StrokeThickness(4).MajorStroke("Whitesmoke"); }) .Series(series => { series.ScatterLine("scatterSeries1", Model.DataSeries1) .XAxis("xAxis").YAxis("yAxis").MarkerBrush("Black") .XMemberPath(data => data.SpectralPoint) .YMemberPath(data => data.Wavelength) .ShowTooltip(true) .Thickness(5) .TooltipTemplate("tooltipTemplate"); }) .Series(series => { series.ScatterLine("scatterSeries2", Model.DataSeries2) .XAxis("xAxis").YAxis("yAxis").MarkerBrush("Black") .XMemberPath(data => data.SpectralPoint) .YMemberPath(data => data.Wavelength) .ShowTooltip(true) .Thickness(5) .TooltipTemplate("tooltipTemplate"); }) .Series(series => { series.ScatterLine("scatterSeries3", Model.DataSeries3) .XAxis("xAxis").YAxis("yAxis").MarkerBrush("Black") .XMemberPath(data => data.SpectralPoint) .YMemberPath(data => data.Wavelength) .ShowTooltip(true) .Thickness(5) .TooltipTemplate("tooltipTemplate"); }) .DataBind() .Render() )
Is there any way I can use loop to assign data series dynamically instead of assigning them one by one as I have shown above.
Hi Graham,
Thanks for your reply! I am currently running this against NetAdvantage Ultimate 2013 1. How can i get my hands on the latest SR?
Martin
Martin,
I think there was a bug here where although the series was logically removed from the chart, that it may not be removed from the options bag. Have you tried this against the latest SR? I believe this was resolved recently.
-Graham
I have tried your suggested approach, but I am running into problems here. When using
function removeSeriesWithName(theName) { $("#chart").igDataChart("option", "series", [{ name: theName, remove: true }]); var series = $("#chart").igDataChart("option", "series"); for (var counter = 0; counter < series.length; counter++) { if (series[counter].name === theName) { console.log("ERROR"); } } }
i get "ERROR" printed.
What am I doing wrong?
I'have boned the whole code and finally figured out that if I load the datachart in a method called by a setInterval or setTimeout it shows only one serie.
If I call the code that I pasted in my previous post into pastebin directly from ig.loader() with a simple call, it shows both of the series.
If I place the call in a setTimeout or setInterval it displays only one.
$.ig.loader(function () { setTimeout(function () { allDone(); }, 1);
});
Somebody please help me with this.
Happy new year Lazar,
I don't think that this would be a bug in ignite ui. I'm sure it's my fault, but I still cannot show more series at once. My software gets some parameters and downloads the correspondig data from the webserver by async calls. This goes through many methods called by setIntervals, and all the beauty of javascript, but at the end of all, the data is present at client side and pushed to a method.
This method should add series according to the downloaded data, but for now I have simplified it searching for the bug and still doesn't work. If I try your code running from ig.loader() it works as expected. But as I copy it to my final method (with static data) it shows only one serie, too. I'm sure that it is something stupid mistake but I cannot figure it out. May I ask you again to take a look at my code? I hope you will simply point to the failed parts.
Thank you forward!