RadChart Clear takes a very long time

3 posts, 0 answers
  1. Tibi
    Tibi avatar
    4 posts
    Member since:
    Jan 2008

    Posted 28 Jan 2011 Link to this post

    Hello,

    We are using the Silverlight controls, version 2010 Q3 to create some reports, using a fairly large dataset. The code used to reset a chart dataset is the following:

    radChart1.DefaultView.ChartArea.AdditionalYAxes.Clear();
                radChart1.DefaultView.ChartArea.DataSeries.Clear();
                radChart1.DefaultView.ChartLegend.Items.Clear();
                radChart1.SeriesMappings.Clear();
                radChart2.DefaultView.ChartArea.AdditionalYAxes.Clear();
                radChart2.DefaultView.ChartArea.DataSeries.Clear();
                radChart2.DefaultView.ChartLegend.Items.Clear();
                radChart2.SeriesMappings.Clear();

    One of the problems is that when we try to re-run a report (recreate the chart with a new or same dataset) the following "stages" appear every time:

    1 - it takes a huge amount of time (longer the the creation of the new chart itself) until the old dataset is discarded and the Loading control appears (although the isBusy is set to true at the very beginning of the reset process)
    2 - there is a lot of CPU activity
    3 - at some point, the chart becomes like the screenshot attached (reset data set.png) The normal chart should look like the second screenshot (normal chart.png)

    Could you please advise us where to look further as at this point, the re-run of a report is at least awkward with this problems.
    Thanks for support.
  2. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 02 Feb 2011 Link to this post

    Hello Marian,

    From your code I can see that you are data binding your RadChart using SeriesMappings. In that case clearing the SeriesMappings will automatically clear the chart legend and data series. For better performance you can try clearing the ItemsSource before the series mappings, because this way if the chart tries to rebind itself it won't have any data to bind to. Your code for clearing the charts can look like this:

    radChart1.ItemsSource = null;
    radChart1.SeriesMappings.Clear();
    radChart1.DefaultView.ChartArea.AdditionalYAxes.Clear();
    //radChart1.DefaultView.ChartArea.DataSeries.Clear();
    //radChart1.DefaultView.ChartLegend.Items.Clear();
     
    radChart2.ItemsSource = null;
    radChart2.SeriesMappings.Clear();
    radChart2.DefaultView.ChartArea.AdditionalYAxes.Clear();
    //radChart2.DefaultView.ChartArea.DataSeries.Clear();
    //radChart2.DefaultView.ChartLegend.Items.Clear();

    Hope this helps!

    Greetings,
    Yavor Ivanov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. Tibi
    Tibi avatar
    4 posts
    Member since:
    Jan 2008

    Posted 02 Feb 2011 Link to this post

    Thanks, your solution worked perfectly.

    Best regards.

    Marian Vulpe
    Spectra Computers
Back to Top