Dan H | 6 Dec 10:43 2007

Trouble with GtkPlot

Hello,

currently I'm stumped by GtkPlot. Essentially I stripped down the
"testgtkplot" example and embedded it into my application, but under
most circumstances I can't get any graph to show up (the axes come
up, just no data). What's funny is that if I pack all the canvas,
dataset, plot creation etc. in a callback connected to the "realize"
signal of the containing widget (a GtkFrame), everything shows up
fine. But if the plot is created or changed after the gtk_frame is
fully operational (from within the main event loop), I only get the
white background and the axes, but no plot data. I tried calling
gtk_widget_queue_draw() on the GtkPlot but that didn't change
anything. Below is a code snippet. The whole thing is contained in a
user interface created with Glade.

The whole code is here:

http://www.nanoscience.de/group_r/members/dhaude/tmp/test-0.1.tar.gz

Thanks, --D.

-------------------------------------------

/* everything is static so I don't accidentally lose references */
static struct {
    GtkPlotData *dataset;
    GtkWidget *plot;
    GtkWidget *canvas;
    GtkWidget *container;
    GtkPlotCanvasChild *child;
(Continue reading)

jcupitt | 7 Dec 20:17 2007
Picon

Re: Trouble with GtkPlot

On Dec 6, 2007 9:43 AM, Dan H <dunno <at> stoptrick.com> wrote:
> currently I'm stumped by GtkPlot. Essentially I stripped down the
> "testgtkplot" example and embedded it into my application, but under
> most circumstances I can't get any graph to show up (the axes come
> up, just no data). What's funny is that if I pack all the canvas,

Hi Dan, I've been meaning to write you a reply but been snowed under
with work :(

You're missing calls to gtk_plot_paint(), I think. The GtkPlot widget
is a little non-standard and needs a few extra functions to handle
resize and repaint.

You're welcome to steal code from (this part of) my app if you like.
This makes a gtkplot preview which you can embed in another widget:

http://vips.svn.sourceforge.net/viewvc/vips/nip2/trunk/src/plotview.c?view=markup

And this is a floating window showing a plot:

http://vips.svn.sourceforge.net/viewvc/vips/nip2/trunk/src/plotwindow.c?view=markup

Screenshot here:

http://www.vips.ecs.soton.ac.uk/images/Screenshot-nip2-7.12.2.png

John

-------------------------------------------------------------------------
SF.Net email is sponsored by: 
(Continue reading)


Gmane