[goffice] Fix #380513 and #680636.
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Fix #380513 and #680636.
- Date: Thu, 26 Jul 2012 16:49:24 +0000 (UTC)
commit c57ad3953d4460baea88468f18e5b88f1e2f556f
Author: Jean Brefort <jean brefort normalesup org>
Date: Thu Jul 26 18:48:29 2012 +0200
Fix #380513 and #680636.
ChangeLog | 14 ++++++++
NEWS | 2 +
goffice/graph/gog-axis.c | 67 +++++++++++++++++++++++++++++++++++++---
goffice/graph/gog-axis.h | 2 +
goffice/graph/gog-chart-map.c | 28 +++++++++++++++++
goffice/graph/gog-plot.c | 2 +-
goffice/graph/gog-series.c | 4 ++
goffice/graph/gog-series.h | 4 ++
plugins/plot_xy/gog-xy.c | 4 ++
9 files changed, 121 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f26d1e1..dc8ef60 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2012-07-26 Jean Brefort <jean brefort normalesup org>
+ * goffice/graph/gog-axis.c (gog_axis_map_get_real_extents),
+ (gog_axis_map_get_real_bounds): new functions taking the axis span into
+ account.
+ * goffice/graph/gog-axis.h: ditto.
+ * goffice/graph/gog-chart-map.c (xy_make_close_path): take new fill type
+ into account.
+ * goffice/graph/gog-plot.c (gog_plot_populate_editor): allow axis choice for
+ pseudo-3d plots. [see #680636]
+ * goffice/graph/gog-series.c: allow filling to axis limits. [#680513]
+ * goffice/graph/gog-series.h: ditto.
+ * plugins/plot_xy/gog-xy.c (gog_xy_series_class_init): ditto.
+
+2012-07-26 Jean Brefort <jean brefort normalesup org>
+
* plugins/plot_surface/gog-contour.c
(gog_contour_plot_foreach_elem): add series name to the elements. [#680508]
* plugins/plot_surface/gog-xyz-surface.c
diff --git a/NEWS b/NEWS
index d75d80a..6c3300e 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ Jean:
* Use NAN instead of 0 for XYZ plots when data are missing. [#680486]
* Add series name to legend for contour plots. [#680508]
* Fix contour plot cardinality when axis bounds can't be retrieved. [680512]
+ * Allow axis choice for pseudo-3d plots. [see #680636]
+ * Allow filling to axis limits. [#680513]
Morten:
* Minute accuracy improvement to matrix inversion.
diff --git a/goffice/graph/gog-axis.c b/goffice/graph/gog-axis.c
index 25a2c90..69d9273 100644
--- a/goffice/graph/gog-axis.c
+++ b/goffice/graph/gog-axis.c
@@ -1715,9 +1715,9 @@ gog_axis_map_get_baseline (GogAxisMap *map)
* @start: location to store start for this axis
* @stop: location to store stop for this axis
*
- * Gets start and stop for the given axis map in data coordinates. If
- * axis is not inverted, start = minimum and stop = maximum. If axis is invalid,
- * it'll return arbitrary bounds.
+ * Gets start and stop for the whole chart relative to the given axis map
+ * in data coordinates. If axis is not inverted, start = minimum and
+ * stop = maximum. If axis is invalid, it'll return arbitrary bounds.
*
* Any of @start and @stop may be NULL.
**/
@@ -1753,13 +1753,42 @@ gog_axis_map_get_extents (GogAxisMap *map, double *start, double *stop)
}
/**
+ * gog_axis_map_get_real_extents:
+ * @map: a #GogAxisMap
+ * @start: location to store start for this axis
+ * @stop: location to store stop for this axis
+ *
+ * Gets start and stop for the given axis map in data coordinates. If
+ * axis is not inverted, start = minimum and stop = maximum. If axis is invalid,
+ * it'll return arbitrary bounds.
+ *
+ * Any of @start and @stop may be NULL.
+ **/
+
+void
+gog_axis_map_get_real_extents (GogAxisMap *map, double *start, double *stop)
+{
+ double x0, x1;
+ g_return_if_fail (map != NULL);
+
+ if (gog_axis_is_inverted (map->axis))
+ map->desc->map_bounds (map, &x1, &x0);
+ else
+ map->desc->map_bounds (map, &x0, &x1);
+ if (start)
+ *start = x0;
+ if (stop)
+ *stop = x1;
+}
+
+/**
* gog_axis_map_get_bounds:
* @map: a #GogAxisMap
* @minimum: location to store minimum for this axis
* @maximum: location to store maximum for this axis
*
- * Gets bounds for the given axis map in data coordinates. If axis is invalid,
- * it'll return arbitrary bounds.
+ * Gets bounds for the whole chart relative to the given axis map in data
+ * coordinates. If axis is invalid, it'll return arbitrary bounds.
*
* Any of @minimum and @maximum may be NULL.
**/
@@ -1795,6 +1824,34 @@ gog_axis_map_get_bounds (GogAxisMap *map, double *minimum, double *maximum)
}
/**
+ * gog_axis_map_get_real_bounds:
+ * @map: a #GogAxisMap
+ * @minimum: location to store minimum for this axis
+ * @maximum: location to store maximum for this axis
+ *
+ * Gets bounds for the given axis map in data coordinates. If axis is invalid,
+ * it'll return arbitrary bounds.
+ *
+ * Any of @minimum and @maximum may be NULL.
+ **/
+
+void
+gog_axis_map_get_real_bounds (GogAxisMap *map, double *minimum, double *maximum)
+{
+ double x0, x1;
+ g_return_if_fail (map != NULL);
+
+ if (gog_axis_is_inverted (map->axis))
+ map->desc->map_bounds (map, &x1, &x0);
+ else
+ map->desc->map_bounds (map, &x0, &x1);
+ if (minimum)
+ *minimum = (map->axis->inverted)? x1: x0;
+ if (maximum)
+ *maximum = (map->axis->inverted)? x0: x1;
+}
+
+/**
* gog_axis_map_is_inverted:
* @map: a #GogAxisMap
*
diff --git a/goffice/graph/gog-axis.h b/goffice/graph/gog-axis.h
index cedc02a..e56447a 100644
--- a/goffice/graph/gog-axis.h
+++ b/goffice/graph/gog-axis.h
@@ -58,7 +58,9 @@ double gog_axis_map_from_view (GogAxisMap *map, double value);
gboolean gog_axis_map_finite (GogAxisMap *map, double value);
double gog_axis_map_get_baseline (GogAxisMap *map);
void gog_axis_map_get_extents (GogAxisMap *map, double *start, double *stop);
+void gog_axis_map_get_real_extents (GogAxisMap *map, double *start, double *stop);
void gog_axis_map_get_bounds (GogAxisMap *map, double *minimum, double *maximum);
+void gog_axis_map_get_real_bounds (GogAxisMap *map, double *start, double *stop);
void gog_axis_map_free (GogAxisMap *map);
gboolean gog_axis_map_is_valid (GogAxisMap *map);
gboolean gog_axis_map_is_inverted (GogAxisMap *map);
diff --git a/goffice/graph/gog-chart-map.c b/goffice/graph/gog-chart-map.c
index eba3781..e15999b 100644
--- a/goffice/graph/gog-chart-map.c
+++ b/goffice/graph/gog-chart-map.c
@@ -593,6 +593,34 @@ xy_make_close_path (GogChartMap *map, double const *x, double const *y,
break;
case GOG_SERIES_FILL_TYPE_SELF:
break;
+ case GOG_SERIES_FILL_TYPE_X_AXIS_MIN:
+ close_path = go_path_new ();
+ gog_axis_map_get_real_bounds (x_map, &position, NULL);
+ position = gog_axis_map_to_view (x_map, position);
+ go_path_move_to (close_path, gog_axis_map_to_view (y_map, y_start), position);
+ go_path_line_to (close_path, gog_axis_map_to_view (y_map, y_end), position);
+ break;
+ case GOG_SERIES_FILL_TYPE_X_AXIS_MAX:
+ close_path = go_path_new ();
+ gog_axis_map_get_real_bounds (x_map, NULL, &position);
+ position = gog_axis_map_to_view (x_map, position);
+ go_path_move_to (close_path, gog_axis_map_to_view (y_map, y_start), position);
+ go_path_line_to (close_path, gog_axis_map_to_view (y_map, y_end), position);
+ break;
+ case GOG_SERIES_FILL_TYPE_Y_AXIS_MIN:
+ close_path = go_path_new ();
+ gog_axis_map_get_real_bounds (y_map, &position, NULL);
+ position = gog_axis_map_to_view (y_map, position);
+ go_path_move_to (close_path, gog_axis_map_to_view (x_map, x_start), position);
+ go_path_line_to (close_path, gog_axis_map_to_view (x_map, x_end), position);
+ break;
+ case GOG_SERIES_FILL_TYPE_Y_AXIS_MAX:
+ close_path = go_path_new ();
+ gog_axis_map_get_real_bounds (y_map, NULL, &position);
+ position = gog_axis_map_to_view (y_map, position);
+ go_path_move_to (close_path, gog_axis_map_to_view (x_map, x_start), position);
+ go_path_line_to (close_path, gog_axis_map_to_view (x_map, x_end), position);
+ break;
default:
break;
}
diff --git a/goffice/graph/gog-plot.c b/goffice/graph/gog-plot.c
index 83fea97..fbec93f 100644
--- a/goffice/graph/gog-plot.c
+++ b/goffice/graph/gog-plot.c
@@ -195,7 +195,7 @@ gog_plot_populate_editor (GogObject *obj,
g_return_if_fail (chart != NULL);
- if (gog_chart_get_axis_set (chart) == GOG_AXIS_SET_XY) {
+ if ((gog_chart_get_axis_set (chart) & GOG_AXIS_SET_FUNDAMENTAL) == GOG_AXIS_SET_XY) {
GtkWidget *combo;
GtkWidget *table = gtk_table_new (0, 1, FALSE);
diff --git a/goffice/graph/gog-series.c b/goffice/graph/gog-series.c
index a972055..5b4f97a 100644
--- a/goffice/graph/gog-series.c
+++ b/goffice/graph/gog-series.c
@@ -51,6 +51,10 @@ static struct {
{GOG_SERIES_FILL_TYPE_EDGE, "edge", N_("Edge")},
{GOG_SERIES_FILL_TYPE_SELF, "self", N_("Self")},
{GOG_SERIES_FILL_TYPE_NEXT, "next", N_("Next series")},
+ {GOG_SERIES_FILL_TYPE_X_AXIS_MIN, "x-axis-min", N_("X axis minimum")},
+ {GOG_SERIES_FILL_TYPE_X_AXIS_MAX, "x-axis-max", N_("X axis maximum")},
+ {GOG_SERIES_FILL_TYPE_Y_AXIS_MIN, "y-axis-min", N_("Y axis minimum")},
+ {GOG_SERIES_FILL_TYPE_Y_AXIS_MAX, "y-axis-max", N_("Y axis maximum")},
{GOG_SERIES_FILL_TYPE_INVALID, "invalid", ""}
};
diff --git a/goffice/graph/gog-series.h b/goffice/graph/gog-series.h
index 955c69b..d605618 100644
--- a/goffice/graph/gog-series.h
+++ b/goffice/graph/gog-series.h
@@ -37,6 +37,10 @@ typedef enum {
GOG_SERIES_FILL_TYPE_EDGE,
GOG_SERIES_FILL_TYPE_SELF,
GOG_SERIES_FILL_TYPE_NEXT,
+ GOG_SERIES_FILL_TYPE_X_AXIS_MIN,
+ GOG_SERIES_FILL_TYPE_X_AXIS_MAX,
+ GOG_SERIES_FILL_TYPE_Y_AXIS_MIN,
+ GOG_SERIES_FILL_TYPE_Y_AXIS_MAX,
GOG_SERIES_FILL_TYPE_INVALID
} GogSeriesFillType;
diff --git a/plugins/plot_xy/gog-xy.c b/plugins/plot_xy/gog-xy.c
index cf0f6fb..4fd9fb3 100644
--- a/plugins/plot_xy/gog-xy.c
+++ b/plugins/plot_xy/gog-xy.c
@@ -2151,6 +2151,10 @@ gog_xy_series_class_init (GogStyledObjectClass *gso_klass)
GOG_SERIES_FILL_TYPE_X_ORIGIN,
GOG_SERIES_FILL_TYPE_SELF,
GOG_SERIES_FILL_TYPE_NEXT,
+ GOG_SERIES_FILL_TYPE_X_AXIS_MIN,
+ GOG_SERIES_FILL_TYPE_X_AXIS_MAX,
+ GOG_SERIES_FILL_TYPE_Y_AXIS_MIN,
+ GOG_SERIES_FILL_TYPE_Y_AXIS_MAX,
GOG_SERIES_FILL_TYPE_INVALID
};
GogObjectClass *gog_klass = (GogObjectClass *)gso_klass;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]