GNOME Bugzilla – Bug 382666
Give (X,Y) coordinates of the cursor in a XY chart
Last modified: 2009-10-19 12:32:55 UTC
It would be nice to have information on the (X,Y) position of the cursor in a XY chart. It is useful when, e.g., trying to locate a particular point on a curve. I have no clear idea of the appropriate UI for that, though.
We could probably show this in the status line.
I agree would be really useful, especially when the plot is in logscale.
We ought to do this before 1.10. Jean? Bonus points for rate-limiting this to (say) 20 times per second.
This should be easy. I just missed that bug.
I think this should be implemented in SheetObjectGraph code. The other possibility is in GocGraph. Both things are possible.
After some testing it appears that it is easiest to have that code in GocCanvas. That said, this should not concern only XY plots, but as many plot types as possible, which is almost all except 3d plots where things will be much more difficult (may be later). I think that if there are several axes of the same type in the chart, the first axis should be used for the map (or the first with a valid map). The data might appear in a tooltip. Morten (and others), any comment?
I agree with that analysis. As long as the screen coordinates uniquely identify axis coordinates (i.e., <= 2 dimensions) we should be able to display the coordinates. That includes polar coordinates. Don't worry about multiple axes for now. Picking the first is just fine.
Created attachment 145673 [details] [review] initial patch This adds the requested feature, limited to XY axis set and not supporting discrete axes. We need to decide what should be displayed for discrete axes (probably the nearest label), and how.
Very interesting. I am getting some very strange effects after a tooltip is shown and I move the cursor out of the graph, but still on the canvas. the tooltip gets shown somewhere and whenever the cursor touches it, it jumps. Also, how about using _("(%s,%s)") as format? The %s formats would be filled with the values as formatted for the relevant axis.
(In reply to comment #9) > Very interesting. > > I am getting some very strange effects after a tooltip is shown and I > move the cursor out of the graph, but still on the canvas. > the tooltip gets shown somewhere and whenever the cursor touches it, > it jumps. goc_graph_leave_notify is needed to ensure that the tooltip is reset on exiting the graph. > Also, how about using _("(%s,%s)") as format? The %s formats would > be filled with the values as formatted for the relevant axis. Sure, that would be much better.
Created attachment 145687 [details] [review] enhanced patch Now using the axis format, but values are displayed with many digits, probably much more than needed.
Let's test it in-place -- please commit. Btw., perhaps the "leave" handler should zero the timestamp. (Just in case someone sets the system clock forward.)
Commited a more involved patch supporting polar plots as well as discrete axes. There are two remaining issues: - sometimes, the coordinates are wrong aftger a fast move (because we skip events occuring just after a previous event); - pies and rings are not supported, it would be nice to display the value and may be the percent and the associated label if any. Looks like this requires a new member function in GogPlotClass, or in GogPlotViewClass?
> sometimes, the coordinates are wrong aftger a fast move (because we skip > events occuring just after a previous event); No big deal: we just have to use the motion event to (re-)schedule a 20ms one-shot timer (and store whatever info we'll need when the timer fires). I am somewhat surprised that we're not using the event coordinates, though. Am I missing something?
(In reply to comment #14) > > sometimes, the coordinates are wrong aftger a fast move (because we skip > > events occuring just after a previous event); > > No big deal: we just have to use the motion event to (re-)schedule a 20ms > one-shot timer (and store whatever info we'll need when the timer fires). seems possible, we need to store the latest x and y, probably in GocGraph. > I am somewhat surprised that we're not using the event coordinates, > though. Am I missing something? The event coordinates are transformed by the canvas and passed as x and y parameters. We only need the event to get the event time.
We now use a timer for updates. Are we done with this?
Seems so unless we do something for pies.