Pre loader

Measure the distance between two points in the plot window (x and y directions)


I was looking if there is a way to measure the distance between two points in plot window? A use case of that would be :
1. Click one point then drag the mouse and get a continuous read-out of the x/y distance between the clicked point and the current pointer position.
2. Create 2 movable inspect points and display the difference between them (Matlab approach)
I have attached an image that highlights the functionality that I wanted.

  • You must to post comments

Hi Sarbesh

Have you tried the MeasureXyAnnotation? This is included in one of our examples here:

enter image description here

You could use one of these to measure an XY distance on the chart, then read the difference between Annotation.X1, Annotation.X2, Annotation.Y1. Annotation.Y2 to get the difference horizontally and vertically. Annotation.ActualWidth / ActualHeight will give you the distance in pixels too.

There is also an API that least you convert pixel coordinates to data-values and vice versa so if you know the pixel coordinates of those areas you can convert them to data-values.

Best regards,

  • You must to post comments

Hi Andrew,
On my chart, I followed the similar example for MeasureXYAnnotation. I have also used the external dependency on my project. ( I wanted to make sure if the basics are working fine, so for that I took the dependency example). But while running the chart, I am getting an exception. This is what I have been getting:

Message=The type initializer for ‘SciChart.Examples.ExternalDependencies.Controls.Toolbar2D.SciChartInteractionToolbar’ threw an exception.
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)

Inner Exception 1:
FileNotFoundException: Could not load file or assembly ‘SciChart.Charting, Version=, Culture=neutral, PublicKeyToken=b55dd9efe817e823’ or one of its dependencies. The system cannot find the file specified.

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies