SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

0
0

I’m having some difficulty with the RolloverData PropertyChanged notification. I have attached an event handler based on your code, which is triggered as I mouse over the chart, but the SeriesInfo collection always has a count of 0. The data bound rollover block does update correctly.

Any ideas?

  • You must to post comments
0
0

Hello Alex,

You’re right – I just looked at the RolloverModifier code and it assigns a new (empty) ObservableCollection before filling it with values.

May I ask, why do you need a notification of rollover? There may be another way to achieve what you want.

It’s a bit messy but the following code should get you a notifcation of new Rollover data

this.rolloverModifier.RolloverData.PropertyChanged += (s, e) =>
{
    // Rollover data was changed
    if (e.PropertyName == "SeriesInfo")
    {                
        this.rolloverModifier.RolloverData.CollectionChanged += (c, args) => 
        {
             // SerisInfo was added to the collection
             // NOTE: Be careful to unsubscribe to events as this handler will keep the
             // ObservableCollection alive on GC
        }
    }
};

Another way might be to handle the MouseMove events and RenderedEvent on SciChartSurface itself and testing for new RolloverData here. For instance:

this.sciChartSurface.MouseMove += (s, e) => OnMouseMoveOrRendered();
this.sciChartSurface.Rendered += (s, e) => OnMouseMoveOrRendered();

private void OnMouseMoveOrRendered()
{
    // Test for rollover data here, which is updated on mouse move
    // and on render of new data
    if (this.rolloverModifier.RolloverData.SeriesInfo != null)
    {
        // ... 
    }
}
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.