Update the chart after binding

2 posts, 0 answers
  1. dani
    dani avatar
    48 posts
    Member since:
    Jan 2011

    Posted 24 Nov 2014 Link to this post

    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.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

  2. Martin Ivanov
    Martin Ivanov avatar
    1442 posts

    Posted 26 Nov 2014 Link to this post

    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. 


    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.

Back to Top