Update the Line Chart automatically

Oct 22, 2012 at 9:27 AM

Hello,

on my page the user can add a new entry to the line chart and then I want to update the graph. But after this update I have all points two times or only the points without a line. How can I update the graph automatically with the new values?

Thanks.

Coordinator
Oct 22, 2012 at 11:30 PM

Could you share some source code?

Oct 24, 2012 at 7:39 AM

It's a little bit difficult to reduce my app to a working demo.

I'm using the WinRT Database (http://winrtdatabase.codeplex.com/) to store my data I want to display. 

List<NameValueItem> sysItems = new List<NameValueItem>();
List<NameValueItem> diaItems = new List<NameValueItem>();

var result = from o in App.BloodViewModel.Blood
             orderby o.Date ascending, o.Time ascending
             select o;

foreach (var item in result)
{
    sysItems.Add(new NameValueItem() { Name = item.Date + "\n" + item.Time, Value = item.SysValue });
    diaItems.Add(new NameValueItem() { Name = item.Date + "\n" + item.Time, Value = item.DiaValue });
}

((LineSeries)LineChart.Series[0]).ItemsSource = diaItems;
((LineSeries)LineChart.Series[1]).ItemsSource = sysItems;

Now is the problem that I want to know if it is possible to refresh the data automatically, because I have to remove all the values and then I need to get all new data, but sometimes I only get dots on my graph and sometimes I get double points...

 

Oct 29, 2012 at 8:43 AM

Hello,

is there a function to remove the whole chart to draw a new one with more or less items?
I have no idea how can I fix my problem, that the graph shows more elements...

Thanks a lot.