epezent / implot

Immediate Mode Plotting
MIT License
4.64k stars 516 forks source link

Changing axis behavior #414

Open tickox opened 1 year ago

tickox commented 1 year ago

Hello,

Is it possible to receive an event when an axis is scrolled?

In the "Candlestick Chart" demo, when you right click on the Y axis, it is possible to change two values, Min and Max. Is it possible to program a function to do this modification after dragging an axis?

Thanks

tickox commented 1 year ago

up

epezent commented 1 year ago

There isn't currently a function to query whether an axis was scrolled. We do have IsAxisHovered, which you could use in combination with ImGui input queries to determine if the axis is currently being clicked or scrolled.

In the "Candlestick Chart" demo, when you right click on the Y axis, it is possible to change two values, Min and Max

Sure, you can use the same approach above to determine when an axis is right clicked (you probably want to disable built-in context menus), and then set the axis min/max values the next frame with SetupAxisLimits.