Re: Traversing through data points and displaying the value
Michael Noble <[email protected]> Fri, 8 Jul 2005 09:36:07 -0400
| Newsgroups | gmane.comp.scigraphica.gtkextra |
|---|---|
| Message-ID | <[email protected]> |
> I was wondering if there is a simple way using the GtkExtra library to
> be able to click at a point in the graph and then by using cursors or
> some other way to traverse from one point to the next and get the y &
> x values as you go along.
Using S-Lang as pseudo-code, add a signal handler for motion events
... = g_signal_connect(canvas,"motion_notify_event", ...
to the canvas, and within the handler do something like
gtk_widget_get_pointer(canvas, &x, &y);
gtk_plot_get_point(plot, x, y, &x, &y);
and display it how you wish, such as in a label
gtk_label_set_text(label, sprintf("( %5.3f, %5.3f )", x, y));
HTH,
-Mike
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar