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
125
Potential Performance issue with Series in WebChart
posted

Hi,

I am having a chart in my UI. I am adding a series to the chart and then assign the DataSource to the series. Chart takes lots of time to render the chart.

 

            int[] zi = new int[356];
            Infragistics.Silverlight.Chart.Series s3 = new Infragistics.Silverlight.Chart.Series();
            s3.ChartType = ChartType.Line;
            for (int j = 0; j < 356; j++)
            {
                zi[j] = j;

            }
            igChart3.Series.Add(s3);
            igChart3.Series[0].DataSource = zi;

 

Alternatively, if I assign data to the series and then add the series to chart, it works perfectly(much quicker).

            int[] zi = new int[356];
            Infragistics.Silverlight.Chart.Series s3 = new Infragistics.Silverlight.Chart.Series();
            s3.ChartType = ChartType.Line;
            for (int j = 0; j < 356; j++)
            {
                zi[j] = j;

            }
            s3.DataSource = zi;
            igChart1.Series.Add(s3);

Why is this performance difference?

 

Due to this limitation we are not able to do data binding to the series from XAML code.

 

Regards,

Madhan

Parents
  • 30692
    Verified Answer
    Offline posted

    Madhan,

    please see the documentation for the RefreshEnabled property of the XamWebChart. The crux of the matter is that if your DataSource implements INotifyCollectionChanged, then everytime you make a change to its contents the chart will rerender to accomodate the change you made. This is a good thing, in general, because you want changes to the data source to be respected in the rendering of the chart.

    You don't see the performance problem if you add the data to the collection before adding the series to the chart because the chart has special functionality for when it knows a large amount of data is being added at once, and will disable refreshes while the changes are made. You would see the same functionality if you added all the items to your collection and then made it the data source of the series.

    If you want to tell the chart that you are making a lot of changes and you only want it to refresh once, at the end, then you can do this:

     

    igChart3.RefreshEnabled = false;
    //update the data
    igChart3.RefreshEnabled = true;
    
Reply Children