Updating data point values in chart

4 posts, 0 answers
  1. Jordan
    Jordan avatar
    12 posts
    Member since:
    Jul 2012

    Posted 21 Sep 2012 Link to this post

    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?
  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 26 Sep 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Jordan
    Jordan avatar
    12 posts
    Member since:
    Jul 2012

    Posted 28 Sep 2012 Link to this post

    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).
  5. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 03 Oct 2012 Link to this post

    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.

Back to Top