Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
145
Getting coordinates from a DataPoint
posted

Hi,

I have a scatter chart and I use the DataItemOver event to get the datapoint that is "highlighted".

I want to be able to add a vertical line that goes from this point all the way to X axis and a horizontal line that goes from this point all the way to Y axis.

I can get the coordinates of the axis with the StartPoint property of the axis.

I need to get the coordinates (X,Y) of the DataPoint. How can I get that information?

 

Thanks,

Imad

Parents
No Data
Reply
  • 26458
    Offline posted

    You can do something like this:

    Point MouseLocation { get; set; }
    Point PointLocation { get; set; }
    double X { get; set; }
    double Y { get; set; }

    in Form_Load:
    ultraChart1.DataItemOver += (o, args) =>
    {
     object[] values = args.Primitive.Value as object[];
        X = (double)values[0];
        Y = (double)values[1];
     PointLocation = MouseLocation;
     ultraChart1.InvalidateLayers();
    };

    ultraChart1.MouseMove += (o, args) => MouseLocation = args.Location;

    in FillSceneGraph event you can either use PointLocation to draw the lines, or you can use axis mapping functions to convert X and Y properties to screen coordinates.

Children