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

Answered
0
0

I am using FastLineRenderableSeries with DateTimeAxis for X-axis.

And, I’m using mouse event to get X-axis value use clicked by mouse.

I’m using code below.

Put vertical line at chart where nearest X value exists, when mouse button clicked

But sometimes MouseButtonEventArgs.GetPosition takes time.

Code like this.

        private void chartSurface_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
                    if (isInitialized == false) return;

                    PerformanceAnalyzer.Start("chartSurface_PreviewMouseDown");

                    // Get mouse point
                    var mousePoint = e.GetPosition(chartSurface);

                    PerformanceAnalyzer.Check("e.GetPosition(chartSurface)");
        }

Normally.
Performance analyze start:2021/09/09 10:55:47 chartSurface_PreviewMouseDown
Performance analyze check:2021/09/09 10:55:47 elapsed:00:00:00.0027280 e.GetPosition(chartSurface)

When slow
Performance analyze start:2021/09/09 10:55:48 chartSurface_PreviewMouseDown
Performance analyze check:2021/09/09 10:55:48 elapsed:00:00:00.4303424 e.GetPosition(chartSurface)

Is there any good way to get more good and stable performance?

Version
6.2.1.13304
  • You must to post comments
Best Answer
1
1

Hi Hiroyuki,

MouseButtonEventArgs.GetPosition(e) is a WPF / C# call, and nothing to do with SciChart, if this is taking time I can only suggest to run a performance profiler on your application and try to see where the time is being spent. Is it in the WPF framework? Or somewhere else blocking the UI thread?

Also have you seen our ChartModifier API? You can create behaviours to tag onto charts. We already handle mouse down and mouse move events for you. You can interact with the chart by creating a custom modifier.

Learn more about this API here:

SciChart WPF: The ChartModifier API

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.