Re: how to set line colour in libgoffice charts
- From: jcupitt gmail com
- To: Jean Bréfort <jean brefort normalesup org>
- Cc: gnumeric-list gnome org
- Subject: Re: how to set line colour in libgoffice charts
- Date: Tue, 27 Oct 2009 15:26:49 +0000
Ooop, my mistake, sorry. It's still not working in my app, though the
same code works in the test program. I'll keep digging. Thank you for
the quick reply.
John
2009/10/27 Jean Bréfort <jean brefort normalesup org>:
You need to use RGBA_RED instead of RGB_RED. Note that these macros are
replaced by GO_COLOR_RED in most recent versions.
Regards,
Jean
Le mardi 27 octobre 2009 à 11:53 +0000, jcupitt gmail com a écrit :
Hello everyone,
I've just updated from 0.7.4 to 0.7.8 (the version that's packaged
with the current Ubuntu as v0.8) and my code can no longer set line
colours.
I made a tiny test program:
----------------
/* Compile with:
gcc -g -Wall chart.c `pkg-config libgoffice-0.8 --cflags --libs`
*/
#include <gtk/gtk.h>
#include <goffice/goffice.h>
#include <goffice/app/go-plugin.h>
#include <goffice/app/go-plugin-loader-module.h>
#include <goffice/data/go-data-simple.h>
#include <goffice/graph/gog-data-set.h>
#include <goffice/graph/gog-label.h>
#include <goffice/graph/gog-object.h>
#include <goffice/graph/gog-plot.h>
#include <goffice/graph/gog-series.h>
#include <goffice/gtk/go-graph-widget.h>
#include <goffice/utils/go-color.h>
static double xes[] = { 1.0, 2.0, 3.0 };
static double yes[] = { 1.0, 12.0, 5.0 };
int
main (int argc, char **argv)
{
GtkWidget *window;
GtkWidget *graph;
GogChart *chart;
GogPlot *plot;
GogSeries *series;
GOData *data;
GError *error;
GOStyle *style;
gtk_init (&argc, &argv);
libgoffice_init ();
go_plugins_init (NULL, NULL, NULL, NULL, TRUE,
GO_TYPE_PLUGIN_LOADER_MODULE);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
graph = go_graph_widget_new (NULL);
gtk_container_add (GTK_CONTAINER (window), graph);
chart = go_graph_widget_get_chart (GO_GRAPH_WIDGET (graph));
plot = gog_plot_new_by_name ("GogXYPlot");
gog_object_add_by_name (GOG_OBJECT (chart), "Plot", GOG_OBJECT (plot));
series = gog_plot_new_series (plot);
data = go_data_vector_val_new (xes, 3, NULL);
gog_series_set_dim (series, 0, data, &error);
data = go_data_vector_val_new (yes, 3, NULL);
gog_series_set_dim (series, 1, data, &error);
style = go_styled_object_get_style (GO_STYLED_OBJECT (series));
style->line.color = RGB_RED;
style->line.auto_color = FALSE;
gog_object_request_update (GOG_OBJECT (series));
// tried this too
// go_styled_object_style_changed (GO_STYLED_OBJECT (series));
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
--------------------
What's the recommended way to set a line colour in 0.7.8?
John
_______________________________________________
gnumeric-list mailing list
gnumeric-list gnome org
http://mail.gnome.org/mailman/listinfo/gnumeric-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]