[goffice] Fix various contour plots issues.
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Fix various contour plots issues.
- Date: Thu, 26 Jul 2012 14:23:58 +0000 (UTC)
commit ccd088e6e6843da25eaeae0138e9face077d3c4f
Author: Jean Brefort <jean brefort normalesup org>
Date: Thu Jul 26 16:23:26 2012 +0200
Fix various contour plots issues.
ChangeLog | 9 +++++++++
NEWS | 5 +++++
goffice/canvas/goc-group.c | 2 +-
goffice/canvas/goc-item.c | 6 +++---
goffice/graph/gog-plot-engine.c | 8 ++++----
goffice/graph/gog-plot.c | 4 ++--
plugins/plot_surface/gog-contour.c | 15 +++++++++++----
plugins/plot_surface/gog-xyz-surface.c | 3 +++
8 files changed, 38 insertions(+), 14 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9d36997..f26d1e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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
+ (gog_xyz_surface_plot_build_matrix): use go_nan instead of 0 when data are
+ missing and fix cardinality when pseudo-3d axis bounds can't be retrieved.
+ [#680486][#680512]
+
2012-07-24 Morten Welinder <terra gnome org>
* goffice/math/go-quad.c (go_quad_add): Complain if not properly
diff --git a/NEWS b/NEWS
index 1cde308..d75d80a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,10 @@
goffice 0.9.6:
+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]
+
Morten:
* Minute accuracy improvement to matrix inversion.
diff --git a/goffice/canvas/goc-group.c b/goffice/canvas/goc-group.c
index 95d4565..db733d9 100644
--- a/goffice/canvas/goc-group.c
+++ b/goffice/canvas/goc-group.c
@@ -456,7 +456,7 @@ goc_group_cairo_transform (GocGroup const *group, cairo_t *cr, double x, double
* group: #GocGroup
* clip_path: #GOPath
* clip_rule: #cairo_fill_rule_t
- *
+ *
* Clips the drawing inside @path.
*/
void
diff --git a/goffice/canvas/goc-item.c b/goffice/canvas/goc-item.c
index 64fa64f..1e5c638 100644
--- a/goffice/canvas/goc-item.c
+++ b/goffice/canvas/goc-item.c
@@ -765,7 +765,7 @@ goc_item_get_window (GocItem *item)
* goc_item_set_operator: (skip)
* @item: #GocItem
* op: #cairo_operator_t
- *
+ *
* Set the operator used when drawing the item.
*/
void
@@ -778,7 +778,7 @@ goc_item_set_operator (GocItem *item, cairo_operator_t op)
/**
* goc_item_get_operator: (skip)
* @item: #GocItem
- *
+ *
* Returns: the operator used when drawing the item.
*/
cairo_operator_t
@@ -792,7 +792,7 @@ goc_item_get_operator (GocItem *item)
* goc_item_set_transform: (skip)
* @item: #GocItem
* m: #cairo_matrix_t
- *
+ *
* Set the matrix used to transform the item.
*/
void
diff --git a/goffice/graph/gog-plot-engine.c b/goffice/graph/gog-plot-engine.c
index 2886662..5ad499c 100644
--- a/goffice/graph/gog-plot-engine.c
+++ b/goffice/graph/gog-plot-engine.c
@@ -687,7 +687,7 @@ create_plot_families (void)
/**
* gog_plot_families: (skip)
- *
+ *
* Returns: (transfer none) the registered plot families.
*/
GHashTable const *
@@ -701,7 +701,7 @@ gog_plot_families (void)
/**
* gog_plot_family_by_name: (skip)
* @name: family name
- *
+ *
* Returns: the plot family if it exists.
*/
GogPlotFamily *
@@ -718,7 +718,7 @@ gog_plot_family_by_name (char const *name)
* @sample_image_file: the sample image file name.
* @priority:
* @axis_set: the used axis set.
- *
+ *
* Returns: the new #GogPlotFamily.
*/
GogPlotFamily *
@@ -761,7 +761,7 @@ gog_plot_family_unregister (GogPlotFamily *family)
* @sample_image_file: the sample image file name.
* @description: the plot type description.
* @engine: the plot engine name.
- *
+ *
* Returns: the new #GogPlotType.
*/
GogPlotType *
diff --git a/goffice/graph/gog-plot.c b/goffice/graph/gog-plot.c
index 9afa6ce..83fea97 100644
--- a/goffice/graph/gog-plot.c
+++ b/goffice/graph/gog-plot.c
@@ -583,7 +583,7 @@ gog_plot_enum_in_reverse (GogPlot const *plot)
* @only_visible: whether to restrict to visible elements.
* @handler: (scope call): #GogEnumFunc
* @data: user data for @func
- *
+ *
* Executes @funcfor each plot element. Used to build a legend.
**/
void
@@ -882,7 +882,7 @@ gog_plot_get_axis_id (GogPlot const *plot, GogAxisType type)
* gog_plot_get_axis:
* @plot: #GogPlot
* type: #GogAxisType
- *
+ *
* Returns: (transfer none): the axis if any.
*/
GogAxis *
diff --git a/plugins/plot_surface/gog-contour.c b/plugins/plot_surface/gog-contour.c
index a63b02b..17e9d19 100644
--- a/plugins/plot_surface/gog-contour.c
+++ b/plugins/plot_surface/gog-contour.c
@@ -60,8 +60,11 @@ gog_contour_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality_cha
double *data, minimum, maximum, slope, offset = 0.;
unsigned max;
- if (!gog_axis_get_bounds (axis, &minimum, &maximum))
+ if (!gog_axis_get_bounds (axis, &minimum, &maximum)) {
+ series->num_elements = 2;
+ *cardinality_changed = TRUE;
return NULL;
+ }
data = g_new (double, n);
nticks = gog_axis_get_ticks (axis, &zticks);
map = gog_axis_map_new (axis, 0, 1);
@@ -143,6 +146,10 @@ gog_contour_plot_foreach_elem (GogPlot *plot, gboolean only_visible,
double minimum, maximum, epsilon;
char const *separator = go_locale_get_decimal ()->str;
+ /* First get the series name and style */
+ func (0, go_styled_object_get_style (plot->series->data),
+ gog_object_get_name (plot->series->data), NULL, data);
+
gog_axis_get_bounds (axis, &minimum, &maximum);
nticks = gog_axis_get_ticks (axis, &zticks);
@@ -190,7 +197,7 @@ gog_contour_plot_foreach_elem (GogPlot *plot, gboolean only_visible,
gog_theme_fillin_style (theme, style, GOG_OBJECT (plot->series->data), i, style->interesting_fields);
label = g_strdup_printf ("[%g%s %g]", minimum, separator,
limits[i - j]);
- (func) (i, style, label, NULL, data);
+ (func) (i + 1, style, label, NULL, data);
g_free (label);
}
} else {
@@ -198,7 +205,7 @@ gog_contour_plot_foreach_elem (GogPlot *plot, gboolean only_visible,
style->fill.pattern.back = color[0];
label = g_strdup_printf ("[%g%s %g]", minimum, separator,
limits[0]);
- (func) (0, style, label, NULL, data);
+ (func) (1, style, label, NULL, data);
g_free (label);
i = 1;
j++;
@@ -208,7 +215,7 @@ gog_contour_plot_foreach_elem (GogPlot *plot, gboolean only_visible,
style->fill.pattern.back = color[i];
label = g_strdup_printf ("[%g%s %g%c", limits[i], separator,
limits[i + 1], (i == j - 1)? ']':'[');
- (func) (i, style, label, NULL, data);
+ (func) (i + 1, style, label, NULL, data);
g_free (label);
}
}
diff --git a/plugins/plot_surface/gog-xyz-surface.c b/plugins/plot_surface/gog-xyz-surface.c
index 706c6cd..d2b34bb 100644
--- a/plugins/plot_surface/gog-xyz-surface.c
+++ b/plugins/plot_surface/gog-xyz-surface.c
@@ -152,6 +152,7 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality
for (k = 0; k < n; ++k)
if (grid[k] != 0)
data[k] /= grid[k];
+ else data[k] = go_nan;
if (GOG_IS_CONTOUR_PLOT (plot)) {
GogAxisMap *map;
@@ -162,6 +163,8 @@ gog_xyz_surface_plot_build_matrix (GogXYZPlot const *plot, gboolean *cardinality
unsigned max;
if (!gog_axis_get_bounds (axis, &minimum, &maximum)) {
+ series->num_elements = 2; /* series name and one slice */
+ *cardinality_changed = TRUE;
g_free (grid);
g_free (data);
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]