After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 382666 - Give (X,Y) coordinates of the cursor in a XY chart
Give (X,Y) coordinates of the cursor in a XY chart
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Charting
git master
Other All
: Normal enhancement
: ---
Assigned To: Jean Bréfort
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2006-12-05 17:26 UTC by Frederic Parrenin
Modified: 2009-10-19 12:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
initial patch (3.37 KB, patch)
2009-10-17 15:19 UTC, Jean Bréfort
none Details | Review
enhanced patch (3.85 KB, patch)
2009-10-17 18:39 UTC, Jean Bréfort
none Details | Review

Description Frederic Parrenin 2006-12-05 17:26:14 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.
Comment 1 Morten Welinder 2006-12-29 20:40:09 UTC
We could probably show this in the status line.
Comment 2 Antonio 2007-05-08 13:40:08 UTC
I agree would be really useful, especially when the plot is in logscale.
Comment 3 Morten Welinder 2009-10-16 18:17:52 UTC
We ought to do this before 1.10.  Jean?

Bonus points for rate-limiting this to (say) 20 times per second.
Comment 4 Jean Bréfort 2009-10-16 18:29:32 UTC
This should be easy. I just missed that bug.
Comment 5 Jean Bréfort 2009-10-16 19:37:23 UTC
I think this should be implemented in SheetObjectGraph code. The other possibility is in GocGraph. Both things are possible.
Comment 6 Jean Bréfort 2009-10-17 14:19:31 UTC
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?
Comment 7 Morten Welinder 2009-10-17 14:55:07 UTC
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.
Comment 8 Jean Bréfort 2009-10-17 15:19:33 UTC
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.
Comment 9 Morten Welinder 2009-10-17 16:20:20 UTC
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.
Comment 10 Jean Bréfort 2009-10-17 16:42:19 UTC
(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.
Comment 11 Jean Bréfort 2009-10-17 18:39:44 UTC
Created attachment 145687 [details] [review]
enhanced patch

Now using the axis format, but values are displayed with many digits, probably much more than needed.
Comment 12 Morten Welinder 2009-10-17 23:41:51 UTC
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.)
Comment 13 Jean Bréfort 2009-10-18 12:23:29 UTC
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?
Comment 14 Morten Welinder 2009-10-18 13:50:36 UTC
> 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?
Comment 15 Jean Bréfort 2009-10-18 14:30:22 UTC
(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.
Comment 16 Morten Welinder 2009-10-18 20:46:17 UTC
We now use a timer for updates.

Are we done with this?
Comment 17 Jean Bréfort 2009-10-19 04:41:37 UTC
Seems so unless we do something for pies.