Re: gtkdatabox-0.8.0.0 released
- From: Laurent Perez <laurent perez unicaen fr>
- To: gtkdatabox <gtkdatabox-list gnome org>
- Subject: Re: gtkdatabox-0.8.0.0 released
- Date: Tue, 27 Nov 2007 14:36:38 +0100
Hi Roland,
Many thanks for all this great work !
As far as I have tested, all work fine with a Slackware 12
(glib2-2.12.12 / gtk+2-2.10.13 / pango-1.16.4 / cairo-1.4.10)
I can't succeed in having logarithmic scaling and auto rescale (example
attached).
I find "gtk_databox_set_total_limits (box, top_left, bottom_right)"
function a little confusing. I would have prefere
"gtk_databox_set_total_limits (box, bottom_left, top_right)" or
"gtk_databox_set_total_limits (box, x_min_max, y_min_max)" but I think
it's just a matter of habit.
Regards ;
Laurent.
/* gcc linlog.c -o linlog `pkg-config --libs --cflags gtkdatabox` */
#include <math.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include <gtkdatabox.h>
#include <gtkdatabox_lines.h>
#define POINTS 100000
gint main (gint argc, char *argv [])
{
GtkWidget *win, *vbox, *databox, *txt, *table;
GtkDataboxGraph *graph;
GtkDataboxValue top_left, bottom_right;
gfloat *X, *Y;
GdkColor color;
guint i;
color.red = 0;
color.green = 0;
color.blue = 0;
X = g_new0 (gfloat, POINTS);
Y = g_new0 (gfloat, POINTS);
for (i = 1 ; i < POINTS ; i ++)
{
X [i] = i;
Y [i] = log10 (i);
}
gtk_init (&argc, &argv);
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (win, 500, 500);
vbox = gtk_vbox_new (FALSE, 5);
gtk_container_add (GTK_CONTAINER (win), vbox);
txt = gtk_label_new ("y = log10 (x)");
gtk_box_pack_start (GTK_BOX (vbox), txt, FALSE, FALSE, 0);
gtk_databox_create_box_with_scrollbars_and_rulers (&databox, &table, 1, 1, 1, 1);
graph = gtk_databox_lines_new (POINTS, X, Y, &color, 1);
gtk_databox_graph_add (GTK_DATABOX (databox), graph);
/* gtk_databox_auto_rescale (GTK_DATABOX (databox), 0); */
top_left.x = 1;
bottom_right.x = 100000.;
top_left.y = 5;
bottom_right.y = 0;
gtk_databox_set_total_limits (GTK_DATABOX (databox), top_left, bottom_right);
gtk_databox_set_scale_type_x (GTK_DATABOX (databox), GTK_DATABOX_SCALE_LOG);
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
gtk_widget_show_all (win);
g_signal_connect (GTK_OBJECT (win), "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_main ();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]