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

Updating data point values in chart

3 Answers 181 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Jordan
Top achievements
Rank 1
Jordan asked on 21 Sep 2012, 08:32 PM
I'd like to clarify the discussion towards the bottom of this page, http://www.telerik.com/help/silverlight/radchartview-series-databinding.html, specifically:

"If we needed to track the selling of our products in real-time, we can simply put the product types in an observable collection and whenever we update a product's sold quantity, the chart will be updated."

and

"The only requirement left for the code above to work is that our Product class needs to implement INotifyPropertyChanged and raise the PropertyChanged event when its QuantitySold property changes"

If we are using GenericDataPointBinding, how does the chart know that it's the QuantitySold property that it is interested in (because it binds to that property via a lambda)? (This become relevant, if for example, the Product class has other properties, not displayed in the chart, that cause PropertyChanged events). Does the chart listen for a PropertyChange on any property and then attempt to find the new value of the data point?

3 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 26 Sep 2012, 09:49 AM
Hello Jordan,

That's correct. The chart will be updated only if a relevant property in the underlying items is updated. In this very example, if QuantitySold is updated, the chart will reflect the change, while if another property (not involved in ValueBinding/CategoryBinding) is updated, the chart will not be redrawn.

Best regards,
Ves
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Jordan
Top achievements
Rank 1
answered on 28 Sep 2012, 09:01 PM
Perhaps my question wasn't clear -- or perhaps I don't fundamentally understand something.

barSeries.ValueBinding = new GenericDataPointBinding<Product, double>() { ValueSelector = product => product.QuantitySold };

With this code above used for the ValueBinding, how exactly does the Telerik code know that it is the "QuantitySold" property it is interested in? All it has is compiled code in the form or a lamba. It doesn't have a string "QuantitySold" that it can match up against the PropertyChangedEventArgs class it gets (that contains a string PropertyName of the property changed).
0
Ves
Telerik team
answered on 03 Oct 2012, 10:08 AM
Hi Jordan,

This is actually a specific implementation detail so I am afraid I cannot discuss this in a public forum. Nevertheless, you can download the source code and inspect it should you need a deeper understanding in RadChartView's internals.

Best regards,
Ves
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ChartView
Asked by
Jordan
Top achievements
Rank 1
Answers by
Ves
Telerik team
Jordan
Top achievements
Rank 1
Share this question
or