Getting x,y coordinates on an axis line and of an axis label


Author
Message
Kevin Harrison 1
Kevin Harrison 1
Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)
Group: Forum Members
Posts: 176, Visits: 1.9K
Hi guys

We've added functionality where clicking on an axis (hitTestResult.ChartElement == ChartElement.Axis) brings up a context menu. We'd now like to test this by simulating a click in the axis area and therefore need to calculate x,y coordinates.

For points within the chart we already have
private Point CartesianChartPixelCoordinates(NChart nevronChart, int horizontalAxisId, int verticalAxisId, double xValue, double yValue)
   {
    NScale2DToViewTransformation scale2DToViewTransformation = new NScale2DToViewTransformation(nevronControl.View.Context, nevronChart, horizontalAxisId, verticalAxisId);
    NPointF viewPoint = new NPointF();
    scale2DToViewTransformation.Transform(new NVector2DD(xValue, yValue), ref viewPoint);
    return new Point((int) viewPoint.X, (int) viewPoint.Y);
   }

We could use this to click on the axis line (if we got the minimum value displayed on the axis) but is there is an alternative you can suggest to click on the axis label, for instance?

Thanks
Kevin
Replies
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Kevin,

Apologies for the delayed response - it took a while to investigate this. Given the current API you cannot get the bounds of the labels in chart view space. You can get the label horizontal and vertical projection along the axis, but it will be difficult to project those to chart view space. Is this a must have functionality?

Best Regards,
Nevron Support Team


Kevin Harrison 1
Kevin Harrison 1
Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)Supreme Being (79 reputation)
Group: Forum Members
Posts: 176, Visits: 1.9K
Thanks for looking. I thought that might be the case.
We have worked round it for our tests by simulating a click on the axis line as an alternative.

Regards

Kevin
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search