-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Showing values of points in tooltips and hovering markers #56
Comments
It's been a requested feature in the past, so I'm in support of adding something like this. Questions, things to think about:
|
A set of 2 of these can be a perfect solution to replace "QueryX" (#53 (comment)) |
@Prinkesh Is the code available in one of your fork branches? |
Hi @ozlb . Its available on feature/tooltips-and-hover |
I have added few things like showing percentage change of Y values on selection .
We should use flags to turn on/off the tooltips or to choose between percentage change values or absolute value while in selection or query mode
Can also be implemented by user but this kind of features are generally required . So would be a better option to add the in core itself and let the user turn it on/off by flags . |
In #53 (comment) you can see what i so called QueryX; @epezent did reject the PR because with not so much changes can be implemented as custom code externally: can your "values of points" be realized with standard imPlot API as well? |
Yes. The plot mouse position get be retrieved with |
Yes it can be done with standard api as well . // GetPlotMousePos() then
AddRectangleFilled(...)
AddText(...) // If in selection mode change the label as required
MarkerCircle(...) Right now i choose the value of y as nearest point from user input data closest to mouse location . But if we extend it to approx value on the line segment it would be too much code repetition on user end . Also let's say user data is static and loaded when the program starts or is changed only when range of the plot changes . Now to show the markers / tooltips they would have to in-occur an extra cost of iterating through the data to find the nearest point to current location . But this can be done in the On other note how about exposing a callback registration functionality? // void callback(StateArgs...) {
// Implement Custom Rendering based on current State
// }
BeginPlot()
RegisterToolTip(callback);
// Either user can implement this callback or we can provide utils of pre-implemented ones which they can register
// If registered we can call this registered function in the LineRenderer Loop
PlotLine(..) ;
|
Iterate buffer one more time it's inefficient and not necessarily if there will be API functions to push x points and after plot get relative y (getter index/pointer). |
@Prinkesh FYI, it's impossible to compile with gcc in linux and I can't open issue in your fork. |
Can you try now . |
Although a small feature. I think this gives user a better way for seeing and comparing the value instead of showing the value at a fixed position .
Here is an example for the same .
We could also provide value getters for the user for these tooltips . So that they can show different values on hover .
Like if someone wants to see some stats which they don't want to plot but see the values w.r.t to x axis . They could add those in the getters .
The text was updated successfully, but these errors were encountered: