gnucash, charts and interactivity

Christian Stimming stimming at tuhh.de
Sun Nov 22 15:45:23 EST 2009


Dear Jean,

thanks a lot for picking up this old issue, and thanks for your explanation.

Unfortunately, currently AFAIK none of the gnucash developers has recently 
worked with that part of the code. This means we can happily apply concrete 
patches, but I'm afraid currently there is nobody around who could use the 
less concrete ideas for implementing this nice feature again. (Or is someone 
interested? Just go ahead now...)

Am Sonntag, 22. November 2009 schrieb Jean Bréfort:
> https://bugzilla.gnome.org/show_bug.cgi?id=359224
> 
> Btw, the renderer is not unreferenced in
> create_graph_pixbuf, which introduces a memory leak, however, the
> renderer will be needed later, so I think the appropriate way is to use
> g_object_set_data:

Can you verify that http://svn.gnucash.org/trac/changeset/18437 implements 
this correctly? It compiles fine here, but that is all I can check for now.

> Now, the only way I can think of to get a callback for the graph, is to
> use a server side html map

Thank you very much for the explanation. However, just to check I understood 
this correctly: Are you saying goffice-0.7.16 implements "something like a 
server side html map" for us? Do I understand correctly: We need to install a 
callback which you've described in your message, and due to the new 
gog_plot_view_get_data_at_point goffice will look up the series and index for 
us? Then the only question remaining is how we could install the callback to 
the pixbuf?

And of course gnucash itself must do something meaningful with the callback on 
the series and data point. Currently I wouldn't know how to go on with this, 
but I guess someone more clever than me should be able to integrate this in 
our framework.

Regards,

Christian


> ( http://www.w3.org/TR/html401/struct/objects.html#h-13.6.2 ). The URI
> needs to include some way to know which pixbuf has been clicked, then
> you just need a callback such as:
> 
> graph_clicked_cb (GdkPixbuf *pixbuf, int x, int y)
> 
> with x and y the coordinates given by the called URI as described in the
> HTML specification. Of course, I might miss something, being not
> familiar with gnucah code.
> 
> The callback should contain code such as (needs goffice-0.7.16 to build
> and work):
> 
> GogRenderer *rend = g_object_get (pixbuf, "renderer");
> GogView *view;
> GogSeries *series = NULL;
> unsigned index;
> 
> if (!rend)
> 	return; /* can't do anything without the renderer */
> g_object_get (G_OBJECT (graph->renderer), "view", &view, NULL);
> /* get the appropriate child view */
> view = gog_view_get_view_at_point (view, x, y, NULL, NULL);
> if (!GOG_IS_PLOT_VIEW (view))
> 	return /* clicked occur outside of any plot */
> index = gog_plot_view_get_data_at_point (GOG_PLOT_VIEW (view), x, y,
>  &series); if (index < 0)
> 	return; /* nothing found at (x,y) */
> /* now do want is needed knowing that you have the series and the index
> of  the data inside the series */
> ...
> 
> What is new in that code is gog_plot_view_get_data_at_point which did
> not exist before 0.7.16.
> 
> Hope this helps, best regards,
> Jean
> 
> 
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel
> 



More information about the gnucash-devel mailing list