question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IDraggable: Add multi-axis support

See original GitHub issue

Features 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:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
BambOoxXcommented, Jan 15, 2022

@swharden I just tried the PR, tell me if you see something wrong. Cheers !

2reactions
BambOoxXcommented, Jan 12, 2022

@swharden I am a bit rusty with the PRs but I will try to propose something.

Read more comments on GitHub >

github_iconTop 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 >
ScottPlot Versions
View the latest ScottPlot versions.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found