Lineseries ObservableCollection.Clear()

2 posts, 1 answers
  1. kjellerik
    kjellerik avatar
    14 posts
    Member since:
    Jul 2007

    Posted 16 Sep 2010 Link to this post

    Hi,

    I have a chart which displays 4 lineseries. I bind it to a ChartEntities, using MVVM, which is an AddRangeObservableCollection<T> as proposed in performance tips and tricks. This did wonder when data came from the server the first time, using AddRange, taking 1-5 seconds displaying all the data. However when i try to populate the dataset with a new result a second time, the chart component freezes for 15-20 seconds, before it displays the result. It seemed to be the clearing before AddRange was called that was the problem. 

    To test this out, i created a button which only job was to clear the ChartEntities list (not fill it afterwards). And it confirmed my suspicion, that the clearing makes the chart freeze. 

    My dataset range from 40-200 elements, and the problem is not so clear in the button half. 40 elements only takes like 2 second to clear, but with 192 elements the chart takes 12-13 seconds to just clear the elements from the ChartEntities list, and this does not even include creating the new chart which should be displayed, adding at least 1-5 seconds. While clearing the list, the whole Silverlight application freezes, and nothing can be done. 

    We have a release which testing is starting on Monday, meaning i have to figure this out before then, or just remove this view, so it is quite urgent. Is there anything that can be done?

    <telerikChart:RadChart ItemsSource="{Binding ChartEntities}" x:Name="radChart2" Grid.Column="0" Grid.Row="1" Margin="15" Grid.ColumnSpan="2">
                <telerikChart:RadChart.DefaultView>
                    <charting:ChartDefaultView>
                        <charting:ChartDefaultView.ChartLegend>
                            <charting:ChartLegend x:Name="chartLegend" Header="Time" UseAutoGeneratedItems="True" />
                        </charting:ChartDefaultView.ChartLegend>
                        <charting:ChartDefaultView.ChartArea>
                            <charting:ChartArea x:Name="chartMain" LegendName="chartLegend" EnableAnimations="False" EnableStripLinesAnimation="False" >
                                <charting:ChartArea.AxisX>
                                    <charting:AxisX  LabelRotationAngle="90" Title="Benchmark sections">
                                    </charting:AxisX>
                                </charting:ChartArea.AxisX>
                                <charting:ChartArea.AxisY>
                                    <charting:AxisY Title="Accumulated days">
                                    </charting:AxisY>
                                </charting:ChartArea.AxisY>
                            </charting:ChartArea>
                        </charting:ChartDefaultView.ChartArea>
                    </charting:ChartDefaultView>
                </telerikChart:RadChart.DefaultView>
     
                <telerikChart:RadChart.SeriesMappings>
                    <charting:SeriesMapping ChartAreaName="chartMain" LegendLabel="Budget">
                        <charting:SeriesMapping.SeriesDefinition>
                            <charting:LineSeriesDefinition ShowPointMarks="False" ShowItemLabels="False" ShowItemToolTips="False" />
                        </charting:SeriesMapping.SeriesDefinition>
                        <charting:SeriesMapping.ItemMappings>
                            <charting:ItemMapping DataPointMember="XValue" FieldName="XValue" />
                            <charting:ItemMapping DataPointMember="YValue"  FieldName="BudgetTimeTotal" />                       
                        </charting:SeriesMapping.ItemMappings>
                    </charting:SeriesMapping>
     
                    <charting:SeriesMapping ChartAreaName="chartMain" LegendLabel="Actual">
                        <charting:SeriesMapping.SeriesDefinition>
                            <charting:LineSeriesDefinition ShowPointMarks="False" ShowItemLabels="False" ShowItemToolTips="False" />
                        </charting:SeriesMapping.SeriesDefinition>
                        <charting:SeriesMapping.ItemMappings>
                            <charting:ItemMapping DataPointMember="XValue" FieldName="XValue" />
                            <charting:ItemMapping DataPointMember="YValue"  FieldName="ActualTimeTotal" />
                        </charting:SeriesMapping.ItemMappings>
                    </charting:SeriesMapping>
     
                    <charting:SeriesMapping ChartAreaName="chartMain" LegendLabel="Planned">
                        <charting:SeriesMapping.SeriesDefinition>
                            <charting:LineSeriesDefinition ShowPointMarks="False" ShowItemLabels="False" ShowItemToolTips="False" />
                        </charting:SeriesMapping.SeriesDefinition>
                        <charting:SeriesMapping.ItemMappings>
                            <charting:ItemMapping DataPointMember="XValue" FieldName="XValue" />
                            <charting:ItemMapping DataPointMember="YValue"  FieldName="PlanTimeTotal" />
                        </charting:SeriesMapping.ItemMappings>
                    </charting:SeriesMapping>
     
                    <charting:SeriesMapping ChartAreaName="chartMain" LegendLabel="Tech.Limit">
                        <charting:SeriesMapping.SeriesDefinition>
                            <charting:LineSeriesDefinition ShowPointMarks="False" ShowItemLabels="False" ShowItemToolTips="False" />
                        </charting:SeriesMapping.SeriesDefinition>
                        <charting:SeriesMapping.ItemMappings>
                            <charting:ItemMapping DataPointMember="XValue" FieldName="XValue" />
                            <charting:ItemMapping DataPointMember="YValue"  FieldName="OptimalTimeTotal" />
                        </charting:SeriesMapping.ItemMappings>
                    </charting:SeriesMapping>
                </telerikChart:RadChart.SeriesMappings>
            </telerikChart:RadChart>
  2. Answer
    Ves
    Admin
    Ves avatar
    2927 posts

    Posted 22 Sep 2010 Link to this post

    Hello kjellerik,

    I am afraid the issue exists in the official release as described and there is not much that can be done for the moment. The good news is that our developers have already fixed it and the fix will be included in the upcoming Service Pack 2, expected to be out by the end of the month. I can see the fix comes a bit too late, but still I hope you will be able to plug that view back in, once the SP is out.

    Best regards,
    Ves
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top