This is a migrated thread and some comments may be shown as answers.

Update the chart after binding

1 Answer 94 Views
Chart
This is a migrated thread and some comments may be shown as answers.
dani
Top achievements
Rank 1
dani asked on 24 Nov 2014, 06:39 AM
I've made a simple bar chart:

BarSeriesDefinition barDefinition = new BarSeriesDefinition();
 barDefinition.Appearance.Fill = new SolidColorBrush( Colors.Blue );
ctrlLaneGraph.DefaultSeriesDefinition = barDefinition;
 SeriesMapping seriesMapping = new SeriesMapping();
seriesMapping.LegendLabel = "Number of Items";
seriesMapping.SeriesDefinition = new SplineSeriesDefinition();
 seriesMapping.ItemMappings.Add(new ItemMapping("ItemStart", DataPointMember.XValue));
seriesMapping.ItemMappings.Add(new ItemMapping("ItemPosition", DataPointMember.YValue));
 seriesMapping.SeriesDefinition = barDefinition;       
ctrlLaneGraph.SeriesMappings.Add(seriesMapping);
 ctrlLaneGraph.ItemsSource = ItemPosisionList;
 ctrlLaneGraph.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Auto;

The ItemPositionList is being regenerated on a timer every 5 seconds. 
How can I update the chart  ? 
 I've Try setting the ItemSource again - but I get a thread ownership exception
I want to make the update smooth without "repainting" things that did not change
Thanks, 
Dani

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 26 Nov 2014, 11:36 AM
Hello Dani,

Thank you for the code snippet. Based on it I created a small project to test the reported case and try to reproduce the exception, however, without any result. This is why I attached the project. Can you please take a look at it and see if I am missing something?

Also, I want to note you that RadChart is our old charting components which has many known issues and limitations. This is why we introduced new charting suite called RadChartView, that resolves many of the issues of RadChart. The new components have better implementation and improved performance, also, they are very flexible and easier to set up. You can read about the differences between the charts in the RadChart vs. RadChartView help article.

If you are just starting to use RadChart or if its integration with y our project is not too complicated I recommend you to use RadChartView instead. 


Regards,
Martin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart
Asked by
dani
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or