Refresh Chart after New Data

Jun 10, 2013 at 3:02 PM
I have an observable collection bound to a HiLoOpenClose series. I first load the chart and ensure the window is drawn. I have a data load executing in an asynchronous fashion. When the data finally loads I do not see that the data is then loaded into the chart. I am using a BindableCollection from Caliburn.Micro and using Caliburn.Micro for binding of the view to the view model. If I load the data as the ViewModel constructor is loaded then data gets loaded, but if I do it asynchronously then the chart is not loaded with data. Is the series truly observing for new points?
Jun 10, 2013 at 3:37 PM
Scratch that. I must have been doing something wrong in my Ansyc call because I re-wrote the asynchronous method with using async tasks instead of WebClient.DownloadStringAsync and it works now. Sorry for the alarm.

Keep up the good work. This charting toolkit looks very promising.
Jun 19, 2013 at 9:00 PM
I am having a similar problem. When my data changes, I have a break point on the "get" of my data, and it shows that it is definitely there. but, it never updates the chart. NOTE: I set a data binding to the x axis header from the same data source, and I had no problem there. Just not updating the graph.

a strange thing to. if I deploy to the emulator in debug mode, the grid doesnt load on the initial load. I stop the debugger, but then go back into the app just in the emulator, and the graph loads initially, but wont change when I change the data.
Jun 20, 2013 at 6:00 AM

Could please provide me the code sample for reproducing the issue?.That will be helpful for me to serve you better.

Vinoth Kumar J
Jun 20, 2013 at 11:29 AM
Sorry about that. I am using mvvm to do my data binding.

my XAML is this:
            <Chart:SparrowChart Margin="15,15,46,5" Height="175" Visibility="Visible">
                    <Chart:LinearXAxis Interval="2" />
                    <Chart:LinearYAxis Interval="1"/>
                <Chart:SplineSeries PointsSource="{Binding tidePoints}" XPath="X" YPath="Y" IsRefresh="True">
My code is:

// this is my callback from a SOAP web service. This works just fine. and other elements at this DataContext level works just fine on my screen. the issue is that
// the chart just doesn't seem to populate. I can even populate a standard listbox at the same DataContext level as the chart, and it populates just fine
tideClient.getSimpleStationAndPredictionsCompleted += (s, e) =>
// code cut out here. but, tideItem is filled with data that has x and y coordinates
highLowItem.tidePoints.Add(new Model.ChartPoint(tideItem.timeDecimal, tideItem.prediction));
Here is the Model.ChartPoint
public class ChartPoint
    public double X { get; set; }
    public double Y { get; set; }

    public ChartPoint(double x, double y)
        X = x;
        Y = y;           

A typical set of X/Y points could include:
2, -.3
8, 3.5
13, 1.7
19, 6.2

Also note that in the designer, when I am looking at IsInDesignMode, the chart does load properly. but, when I run in the emulator, it seems that the chart element loads before the data shows up, but never gets updated (but all other elements on the screen have no problem updating, even a table that I could hold the same points. It just seems that the chart doesn't load)
Jul 31, 2013 at 9:39 AM
Edited Jul 31, 2013 at 1:37 PM
Hello, I'm having the same problem with a dynamic chart, i'm using Caliburn.Micro as the MVVM framework.
If I populate the date list on the OnActivate Method, the graph is not displayed at all. And when I had data to the observable list, the chart is not updated.

Edit: After some breakpoint, it seems that the PointsSource_CollectionChanged from LineSerieBase is never called.
If a add in my own class a a bindablecollection (from Caliburn) and I had a mycollection.CollectionChanged += myMethod, this one if called.

below my code:
public class StatisticViewModel : Screen, IShell
        public IObservableCollection<Model> Collection
                return _collection;
                _collection = value;
                NotifyOfPropertyChange(() => Collection);

        private IObservableCollection<Model> _collection;
        public StatisticViewModel()
            _collection = new BindableCollection<Model>();
        private void GenerateDatas()
            this.Collection.Add(new Model(0, 1));
            this.Collection.Add(new Model(1, 2));
            this.Collection.Add(new Model(2, 3));
            this.Collection.Add(new Model(3, 4));
        int i = 4;
        protected override void OnActivate()


            Timer timer = new Timer(5000);
            timer.AutoReset = true;
            //timer.Enabled = true;
            timer.Elapsed += timer_Elapsed;

        void timer_Elapsed(object sender, ElapsedEventArgs e)
            this.Collection.Add(new Model(i++,new Random().Next(0,10)));
            NotifyOfPropertyChange(() => Collection);

    public class Model
        public double X
        public double Y

        public Model(double x, double y)
            X = x;
            Y = y;
the Xaml
<UserControl x:Class="TxSGUI.Views.StatisticView"
             d:DesignHeight="300" d:DesignWidth="300">
                <views:StatisticViewModel />
            <sparrow:LineSeries PointsSource="{Binding Collection}" XPath="X" YPath="Y" IsRefresh="True"/>
Thanks in advance.