[goffice] Fixed contour plots legend. [#623887]



commit fc75b487058c2e350b41ddf0e845420c524ed84f
Author: Jean Brefort <jean brefort normalesup org>
Date:   Tue Jul 13 10:19:04 2010 +0200

    Fixed contour plots legend. [#623887]

 ChangeLog                          |    7 +++++++
 NEWS                               |    1 +
 plugins/plot_surface/gog-contour.c |   16 ++++++++++++----
 3 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fe1e856..2605d3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-07-13  Jean Brefort  <jean brefort normalesup org>
+
+	reviewed by: <delete if not using a buddy>
+
+	* plugins/plot_surface/gog-contour.c
+	(gog_contour_plot_foreach_elem):
+
 2010-07-08  Morten Welinder  <terra gnome org>
 
 	* goffice/utils/go-format.c (go_format_details_new,
diff --git a/NEWS b/NEWS
index 0339b5d..da67452 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ goffice 0.8.8:
 Jean:
 	* Do not take manually placed charts into account when evaluating
 	  rows and columns in GogGraph.
+	* Fixed contour plots legend. [#623887]
 
 Morten:
 	* Add go_string_replace function.
diff --git a/plugins/plot_surface/gog-contour.c b/plugins/plot_surface/gog-contour.c
index 1ce6915..71d260e 100644
--- a/plugins/plot_surface/gog-contour.c
+++ b/plugins/plot_surface/gog-contour.c
@@ -146,13 +146,21 @@ gog_contour_plot_foreach_elem  (GogPlot *plot, gboolean only_visible,
 	gog_axis_get_bounds (axis, &minimum, &maximum);
 
 	nticks = gog_axis_get_ticks (axis, &zticks);
-	limits = g_new (double, nticks + 1);
-	for (i = j = 0; i < nticks; i++)
+	i = j = 0;
+	while (zticks[i].type != GOG_AXIS_TICK_MAJOR)
+		i++;
+	if (minimum < zticks[i].position) {
+		limits = g_new (double, nticks + 2);
+		limits[j++] = minimum;
+	} else
+		limits = g_new (double, nticks + 1);
+	for (; i < nticks; i++)
 		if (zticks[i].type == GOG_AXIS_TICK_MAJOR)
 			limits[j++] = zticks[i].position;
-	j--;
 	if (maximum > limits[j])
-		limits[++j] = maximum;
+		limits[j] = maximum;
+	else
+		j--;
 	/* build the colors table */
 	color = g_new0 (GOColor, (j > 0)? j: 1);
 	if (j < 2)



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