IDraggable: Add multi-axis support
See original GitHub issueFeatures Suggestion
Feature description:
The mouse interaction for dragable plottables should take the axis index into account. Currently it seems to call
/// <summary>
/// Return the X position (in coordinate space) for the given pixel column
/// </summary>
/// <param name="xPixel">horizontal pixel location</param>
/// <returns>horizontal position in coordinate space</returns>
public double GetCoordinateX(float xPixel) => settings.XAxis.Dims.GetUnit(xPixel);
/// <summary>
/// Return the Y position (in coordinate space) for the given pixel row
/// </summary>
/// <param name="yPixel">vertical pixel location</param>
/// <returns>vertical position in coordinate space</returns>
public double GetCoordinateY(float yPixe) => settings.XAxis.Dims.GetUnit(yPixel);
Which only works if everything happens on the first axis (X and/or Y). If the plottable is on another set of axes, the IsUnderMouse
and DragTo
methods fail because the coordinates are wrong.
A short term patch could be to consider the second axes too with e.g.
/// <summary>
/// Return the X position (in coordinate space) for the given pixel column
/// </summary>
/// <param name="xPixel">horizontal pixel location</param>
/// <returns>horizontal position in coordinate space</returns>
public double GetCoordinateX(float xPixel,int axisindex = 0) => axisindex == 0 ? settings.XAxis.Dims.GetUnit(xPixel) : settings.XAxis2.Dims.GetUnit(xPixel);
/// <summary>
/// Return the Y position (in coordinate space) for the given pixel row
/// </summary>
/// <param name="yPixel">vertical pixel location</param>
/// <returns>vertical position in coordinate space</returns>
public double GetCoordinateY(float yPixel,int axisindex = 0) => axisindex == 0 ? settings.XAxis.Dims.GetUnit(yPixel) : settings.YAxis2.Dims.GetUnit(yPixel);
If one adds other axes I am not sure how to retrieve the current one…
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
MULTIAXIS LLC - HOME
Solutions. CAMplete TruePath · CAMplete TurnMill · Fusion 360. Support. Contact · What's New · Move to Multiaxis. Connect.
Read more >ScottPlot/CHANGELOG.md at main
Interactive plotting library for .NET. Contribute to ScottPlot/ScottPlot development by creating an account on GitHub.
Read more >Support Library
Dedicated support and learning tools through Multiaxis. Solutions. CAMplete TruePath · CAMplete TurnMill · Fusion 360. Support.
Read more >ScottPlot.Plot
Automatically set axis limits to fit the data. This overload is designed for multi-axis plots (with multiple X axes or multiple Y axes)....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@swharden I just tried the PR, tell me if you see something wrong. Cheers !
@swharden I am a bit rusty with the PRs but I will try to propose something.