? depcomp ? ylwrap ? src/cut-n-paste-code/goffice/.ChangeLog.swp ? src/cut-n-paste-code/goffice/graph/.gog-axis.c.swp ? src/cut-n-paste-code/goffice/graph/.gog-style.c.swp ? src/cut-n-paste-code/goffice/graph/gog-marker-prefs.glade ? src/cut-n-paste-code/goffice/graph/gog-marker.c ? src/cut-n-paste-code/goffice/graph/gog-marker.h Index: src/cut-n-paste-code/goffice/ChangeLog =================================================================== RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/goffice/ChangeLog,v retrieving revision 1.137 diff -u -r1.137 ChangeLog --- src/cut-n-paste-code/goffice/ChangeLog 14 Oct 2003 04:24:29 -0000 1.137 +++ src/cut-n-paste-code/goffice/ChangeLog 15 Oct 2003 12:29:13 -0000 @@ -1,3 +1,12 @@ +2003-10-14 Emmanuel Pacaud + + * graph/gog-axis.c (axis_get_entry) : Add a user_defined parameter in + order to know if the returned value is defined by user or computed. + (gog_axis_update) : Use user defined bound for the tick spacing + calculation. + (gog_axis_num_markers) : round to nearest value instead of the + automatic double to int cast that removes the fractionnal part. + 2003-10-13 Jody Goldberg http://bugzilla.gnome.org/show_bug.cgi?id=122546 Index: src/cut-n-paste-code/goffice/graph/gog-axis.c =================================================================== RCS file: /cvs/gnome/gnumeric/src/cut-n-paste-code/goffice/graph/gog-axis.c,v retrieving revision 1.42 diff -u -r1.42 gog-axis.c --- src/cut-n-paste-code/goffice/graph/gog-axis.c 11 Oct 2003 05:41:34 -0000 1.42 +++ src/cut-n-paste-code/goffice/graph/gog-axis.c 15 Oct 2003 12:29:14 -0000 @@ -292,6 +292,25 @@ (parent_klass->finalize) (obj); } +static double +axis_get_entry (GogAxis const *axis, unsigned i, gboolean *user_defined) +{ + GOData *dat = axis->source [i].data; + if (dat != NULL && IS_GO_DATA_SCALAR (dat)) { + double tmp = go_data_scalar_get_value (GO_DATA_SCALAR (dat)); + if (finite (tmp)) { + if (user_defined) + *user_defined = TRUE; + return tmp; + } + } + + if (user_defined) + *user_defined = FALSE; + + return axis->auto_bound [i]; +} + static void gog_axis_update (GogObject *obj) { @@ -304,6 +323,8 @@ double old_max = axis->auto_bound [AXIS_ELEM_MAX]; GOData *labels; gboolean is_discrete; + gboolean user_defined; + double tmp; gog_debug (0, g_warning ("axis::update");); @@ -344,6 +365,13 @@ minima = axis->min_val; maxima = axis->max_val; + + tmp = axis_get_entry (GOG_AXIS (obj), AXIS_ELEM_MIN, &user_defined); + if (user_defined) minima = tmp; + + tmp = axis_get_entry (GOG_AXIS (obj), AXIS_ELEM_MAX, &user_defined); + if (user_defined) maxima = tmp; + if (minima < maxima) { range = fabs (maxima - minima); if (gnumeric_sub_epsilon (range) < 0.) { @@ -685,18 +713,6 @@ return axis->pos; } -static double -axis_get_entry (GogAxis const *axis, unsigned i) -{ - GOData *dat = axis->source [i].data; - if (dat != NULL && IS_GO_DATA_SCALAR (dat)) { - double tmp = go_data_scalar_get_value (GO_DATA_SCALAR (dat)); - if (finite (tmp)) - return tmp; - } - return axis->auto_bound [i]; -} - /** * gog_axis_is_discrete : * @axis : #GogAxis @@ -723,8 +739,8 @@ { g_return_val_if_fail (GOG_AXIS (axis) != NULL, FALSE); - *minima = axis_get_entry (axis, AXIS_ELEM_MIN); - *maxima = axis_get_entry (axis, AXIS_ELEM_MAX); + *minima = axis_get_entry (axis, AXIS_ELEM_MIN, NULL); + *maxima = axis_get_entry (axis, AXIS_ELEM_MAX, NULL); return finite (*minima) && finite (*maxima) && *minima < *maxima; } @@ -745,9 +761,9 @@ g_return_if_fail (GOG_AXIS (axis) != NULL); if (major != NULL) - *major = axis_get_entry (axis, AXIS_ELEM_MAJOR_TICK); + *major = axis_get_entry (axis, AXIS_ELEM_MAJOR_TICK, NULL); if (minor != NULL) - *minor = axis_get_entry (axis, AXIS_ELEM_MINOR_TICK); + *minor = axis_get_entry (axis, AXIS_ELEM_MINOR_TICK, NULL); } /** @@ -845,11 +861,11 @@ return gnumeric_fake_trunc (axis->max_val); return 0; } else { - double major_tick = axis_get_entry (axis, AXIS_ELEM_MAJOR_TICK); + double major_tick = axis_get_entry (axis, AXIS_ELEM_MAJOR_TICK, NULL); if (major_tick <= 0. || !gog_axis_get_bounds (axis, &minima, &maxima)) return 0; - return 1 + fabs (maxima - minima) / major_tick; + return 1.5 + fabs (maxima - minima) / major_tick; } } @@ -861,8 +877,8 @@ return go_data_vector_get_str (axis->labels, i); return g_strdup_printf ("%d", i+1); } else { - double major_tick = axis_get_entry (axis, AXIS_ELEM_MAJOR_TICK); - double val = axis_get_entry (axis, AXIS_ELEM_MIN) + + double major_tick = axis_get_entry (axis, AXIS_ELEM_MAJOR_TICK, NULL); + double val = axis_get_entry (axis, AXIS_ELEM_MIN, NULL) + (((double)i) * major_tick); /* force display to 0 if it is within less than a step */