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

why the chart can not update?

1 Answer 137 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Luo
Top achievements
Rank 1
Luo asked on 06 Oct 2012, 02:53 AM

when i use the chart,and use chart.Series[0].ItemsSource = tempDrw ( here the tempDW is a double type array; to draw the line like the attachment.

but i have a problem: when the data in the tempDrw change but the chat can not updata.

1 Answer, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 09 Oct 2012, 08:17 AM
Hello Luo,

From the code that you have provided (chart.Series) it seems that you are talking about the RadChartView and not the RadChart control. This is why I have changed the product of this thread. Let me know if I have made a mistake.

Now, onto your question. The chart not getting updated is expected because double[] is not an observable collection. You will either need to reset the ItemsSource every time you need the chart to update or use an observable collection instead:

reset:
chart.Series[0].ItemsSource = null;
chart.Series[0].ItemsSource = tempDrw;

observable collection:
var oc = new ObservableCollection();
chart.Series[0].ItemsSource = oc;

All the best,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Chart
Asked by
Luo
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or