I do not understand ObservableValue, or what is the difference between passing in an ObservableValue and passing in the original value/type itself?
If I take the following as an example, be it ObservableValue or a double type, the Chart would dynamically populate the random value and update the chart including the animation.
So why ObservableValue? And could someone suggest an example.
Values = new ChartValues<ObservableValue>
{
new ObservableValue(r.Next(10, 400)),
};
Values = new ChartValues<double>
{
(r.Next(10, 400)),
};
If you intend to update an individual value within the
Values
collection dynamically at runtime after you have populated the initial collection and displayed the chart, you need to useObservableValue
for the chart to be able to notify this update and update itself accordingly.There is no event raised when you simply replace a
double
value in the collection like this:...but if you set the
Value
property of anObservableValue
like this, aPropertyChanged
event is raised:The chart subscribes to the
PropertyChanged
event to listen for updates. That's the difference.