Skip to content
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

Open
Prinkesh opened this issue Jun 7, 2020 · 12 comments
Open

Showing values of points in tooltips and hovering markers #56

Prinkesh opened this issue Jun 7, 2020 · 12 comments
Labels
help wanted Extra attention is needed
Projects
Milestone

Comments

@Prinkesh
Copy link

Prinkesh commented Jun 7, 2020

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 .

b68290c6290184728990d120b48fcfd8

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 .

@epezent
Copy link
Owner

epezent commented Jun 7, 2020

It's been a requested feature in the past, so I'm in support of adding something like this. Questions, things to think about:

  • It seems that you've chosen to display values as a function of mouse x location. Should we also support mouse y location?
  • Should this be set via a flag or perhaps via a function call inside of a Begin/EndPlot and before any plot items (similar to what I suggested here Visualisation Improvement ideas/fixes #53 (comment)
  • can this be implemented by the user instead of us if we provide appropriate API utility functions? (e.g. I think this could be done with IsPlotHovered, GetPlotMousePos, and custom rendering). If that's the case, would we be better off showing this as an example in the demo instead of adding it to the API?

@Prinkesh
Copy link
Author

Prinkesh commented Jun 7, 2020

  • It seems that you've chosen to display values as a function of mouse x location. Should we also support mouse y location?

Since X is shared we could be with these kind of markers for X .

08853b6abc4019866c444c2cb9b671bc

@ozlb
Copy link
Contributor

ozlb commented Jun 8, 2020

A set of 2 of these can be a perfect solution to replace "QueryX" (#53 (comment))

@ozlb
Copy link
Contributor

ozlb commented Jun 9, 2020

  • It seems that you've chosen to display values as a function of mouse x location. Should we also support mouse y location?

Since X is shared we could be with these kind of markers for X .

08853b6abc4019866c444c2cb9b671bc

@Prinkesh Is the code available in one of your fork branches?

@Prinkesh
Copy link
Author

Hi @ozlb .

Its available on feature/tooltips-and-hover

@Prinkesh
Copy link
Author

I have added few things like showing percentage change of Y values on selection .

dff5ca0f0c9b0bc25e2beb64400fef2a

Should this be set via a flag or perhaps via a function call inside of a Begin/EndPlot and before any plot items (similar to what I suggested here #53 (comment)

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 this be implemented by the user instead of us if we provide appropriate API utility functions? (e.g. I think this could be done with IsPlotHovered, GetPlotMousePos, and custom rendering). If that's the case, would we be better off showing this as an example in the demo instead of adding it to the API?

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 .

@ozlb
Copy link
Contributor

ozlb commented Jun 21, 2020

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?

@epezent
Copy link
Owner

epezent commented Jun 21, 2020

Yes. The plot mouse position get be retrieved with GetPlotMousePos, and then the closest point in the plot data can be searched for by the user. We might consider adding helper functions that do this.

@Prinkesh
Copy link
Author

Prinkesh commented Jun 21, 2020

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 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 LineRenderer part of code itself . So saving the extra cost on user end .

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(..) ;
   

@ozlb
Copy link
Contributor

ozlb commented Jun 21, 2020

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).
External rendering of makers/cursors/queryX, whatever name you want, should be possible, what about interactivity with it? I mean, if you are operating on it like drag&drop move, you need an API as well to notify it and also another to give info that there are no other operations I guess.

@epezent epezent added the help wanted Extra attention is needed label Jun 24, 2020
@ozlb
Copy link
Contributor

ozlb commented Jul 1, 2020

Hi @ozlb .

Its available on feature/tooltips-and-hover

@Prinkesh FYI, it's impossible to compile with gcc in linux and I can't open issue in your fork.

@Prinkesh
Copy link
Author

Prinkesh commented Jul 1, 2020

Hi @ozlb .
Its available on feature/tooltips-and-hover

@Prinkesh FYI, it's impossible to compile with gcc in linux and I can't open issue in your fork.

Can you try now .

@epezent epezent added this to the v1.0 milestone Jan 18, 2021
@epezent epezent added this to To Do in ImPlot v1.0 via automation Mar 10, 2021
@epezent epezent moved this from To Do to In Progress in ImPlot v1.0 Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
ImPlot v1.0
In Progress
Development

No branches or pull requests

3 participants