Pre loader

Performance issue when legend is added to chart

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
1
0

I’ve created a view with approximately 50 series, each containing ~200 datapoints.

I have noticed that rendering this with the legend showing, has a significant performance impact. I would expect the legend to have a cost, but I’m seing a big change in render time (the chart refreshes when the user checks a checkbox, so the performance has to be good).

I’ve added the legend using the following standard (I believe) xaml:

s:LegendModifier x:Name=”legendModifier”
IsEnabled=”True”
ShowLegend=”True”
Orientation=”Vertical”
Margin=”5″
LegendPlacement=”Inside”
GetLegendDataFor=”AllVisibleSeries”
ShowVisibilityCheckboxes=”False”
ShowSeriesMarkers=”True”
ScrollViewer.VerticalScrollBarVisibility=”Auto”/

When I set IsEnabled=”False” the performance improves significantly.

Does anybody have any hints to how performance can be improved?

Best regards

  • You must to post comments
Best Answer
1
0

Hi Andrew,

Thanks for the quick reply!

I did try using your example, and I must admit that the fault was mine. I had left out the SuspendUpdates call (because I was using databinding).
But after I introduced it , performance is absolutely perfect.

Thanks!

  • You must to post comments
1
0

Hi Bjarne,

Interesting issue you have found here. I did a short investigation, by modifying our Chart Legends example (MutlipleLinesView.xaml in the examples suite) to create 50 series of 200 points:

    private void MultipleLinesView_OnLoaded(object sender, RoutedEventArgs e)
    {
        int count = 50;
        sciChart.RenderableSeries.Clear();
        using (sciChart.SuspendUpdates())
        {
            for (int i = 0; i < count; i++)
            {
                var dataSeries = new XyDataSeries<double, double> {SeriesName = "Curve #" + (i + 1)};
                var data1 = DataManager.Instance.GetStraightLine((i+1)*10, 1.0, 200);
                dataSeries.Append(data1.XData, data1.YData);
                var renderSeries = new FastLineRenderableSeries() {DataSeries = dataSeries};
                sciChart.RenderableSeries.Add(renderSeries);
            }
        }

        // Zoom to extents of the data
        sciChart.ZoomExtents();
    }

The result is below:

5MByte Animated Gif file showing legend performance with 50 series of 200 data-points

Rendering performance seems ok, as does performance of checking / unchecking items. Is this what you observe? Can you take my modification and modify it further until the performance issue occurs? We would be glad to investigate & provide a solution – performance is our middle name!

Best regards,
Andrew

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies