How to update Line series Chart with data consistently RRS feed

  • Question

  • I have a simple line series chart using WPFToolKit. I would like to have new data coming in to be updated on the chart every 5 minutes. But I have no idea how to go about it. The way I am showing data now is this.

     public Window1()

    private void showColumnChart()
    List<KeyValuePair<double,double>> Power = new List<KeyValuePair<double, double>>();
    Power.Add(new KeyValuePair<double, double>(30, 40));
    Power.Add(new KeyValuePair<double,double>(50, 60));
    //Setting data for line chart
    .DataContext = Power;


    Any help would be appreciated.


    Monday, October 3, 2011 5:06 AM


  • Hi David,

    In your case I believe I would try to implement
    a DispatcherTimer in code behind
    and then set an interval (calculated in milliseconds : 1000 = 1 sec...) in a Tick handler
    which consequently would call GetChartDataAsync function
    in order to updade your Chart consistently with modified available new data informations
    sent from a Web service...

    If this answers your question please Mark as an answer. Thank you!

    Wednesday, October 5, 2011 10:39 AM