goffice r2359 - in trunk: . goffice/graph



Author: mortenw
Date: Mon Mar 30 17:20:45 2009
New Revision: 2359
URL: http://svn.gnome.org/viewvc/goffice?rev=2359&view=rev

Log:
2009-03-30  Morten Welinder  <terra gnome org>

	* goffice/graph/gog-axis.c (map_linear_calc_ticks): Drop final
	major tick if it goes beyond the maximum which can happen after we
	align the grid.



Modified:
   trunk/ChangeLog
   trunk/goffice/graph/gog-axis.c

Modified: trunk/goffice/graph/gog-axis.c
==============================================================================
--- trunk/goffice/graph/gog-axis.c	(original)
+++ trunk/goffice/graph/gog-axis.c	Mon Mar 30 17:20:45 2009
@@ -705,10 +705,11 @@
 		}
 	}
 
-	zero_threshold = maj_step * DBL_EPSILON;
+	/* This is the error on the stepping per step.  */
+	zero_threshold = maj_step / 2 * DBL_EPSILON;
 
 	/*
-	 * We now have the steps we have.  It is time to align the steps
+	 * We now have the steps we want.  It is time to align the steps
 	 * so they hit round numbers (where round is relative to the step
 	 * size).  We do this by rounding up the minimum.
 	 *
@@ -718,8 +719,13 @@
 	 *
 	 * The last major tick goes at index N.  There may be minor ticks
 	 * after that.
+	 *
+	 * Also due to the rounding, we may have room for one less major
+	 * tick.
 	 */
 	start = go_fake_ceil (minimum / maj_step) * maj_step;
+	if (start + maj_N * (maj_step - zero_threshold) > maximum)
+		maj_N--;
 
 	N = (maj_N + 2) * min_N;
 	ticks = g_new0 (GogAxisTick, N);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]