Profile Picture

Transform Chart Point to Mouse Position?

Posted By 2 Years Ago
Author
Message
Posted 2 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 2 Years Ago
Posts: 0, Visits: 78
Given a mouse position on a Cartesian chart, I can transform the point into a chart point using the following code:


  protected NPointD TransformMousePositionToChartPoint(NMouseEventArgs e)
   {
    var view2Scale = new NViewToScale2DTransformation(this.cartesianChart, (int)StandardAxis.PrimaryX, (int)StandardAxis.PrimaryY);
    var scalePoint = new NVector2DD();
    view2Scale.Transform(new NPointF(e.X, e.Y), ref scalePoint);
    var transformedPoint = new NPointD();
    transformedPoint.X = scalePoint.X;
    transformedPoint.Y = scalePoint.Y;
    return transformedPoint;
   }


Can I do the reverse? Given a point on the chart, can I transform it into a mouse position? If so, how?

Nevron Support
Posted 2 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: 2 hours ago
Posts: 3,054, Visits: 4,009
Hi,

Yes, you can do the opposite transformation using NScale2DToViewTransformation:

NScale2DToViewTransformation transform = new NScale2DToViewTransformation(chart, (int)StandardAxis.PrimaryX, (int)StandardAxis.PrimaryY);

Let us know if you have any questions.

Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic