Pre loader

Get the coordinate of a data point of the series in c#


I want to click on the data points and get the x and y co-ordinate values stored somewhere, as I further need the data point values. I have already searched for many examples and codes but I’m not able to implement this in my Windows form application (C#). There are some good examples are given on dataPoint selection but I want to use that in my c# code, can you please provide me a example of this in c# instead of xaml.
I have already referred to the below links but not able to find a solution to my problem.

  • You must to post comments

Hi Mohani

The API you need is the Hit-Test API.

If you look at the example in the Hit Test documentation it should be fairly easy to follow.

// Subscribed using this code:
// sciChartSurface.MouseLeftButtonUp += SciChartSurfaceMouseLeftButtonUp;
private void SciChartSurfaceMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
    // Perform the hit test relative to the GridLinesPanel
    Point mousePoint = e.GetPosition(sciChartSurface.GridLinesPanel as UIElement);
    double datapointRadius = 8;
    bool useInterpolation = false;
    HitTestInfo result = sciChartSurface.RenderableSeries[0].HitTestProvider.HitTest(mousePoint,
                                      datapointRadius, useInterpolation);

    // Output results
    string formattedString =
            "{6}:\tMouse Coord: {0:0}, {1:0}\t\tNearest Datapoint Coord: {2:0.0},
                                  {3:0.0}\tData Value: {4:0.0}, {5:0.0}",
            mousePoint.X, mousePoint.Y,
            result.HitTestPoint.X, result.HitTestPoint.Y,
            result.XValue, result.YValue,


Let me know if this helps

Best regards,

  • You must to post comments
Showing 1 result
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