[goffice] Radar/Polar: improve handling of log axis.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Radar/Polar: improve handling of log axis.
- Date: Wed, 25 Mar 2015 12:28:11 +0000 (UTC)
commit ba078227e0445d496111f5317808ac1b632dee95
Author: Morten Welinder <terra gnome org>
Date: Wed Mar 25 08:27:43 2015 -0400
Radar/Polar: improve handling of log axis.
ChangeLog | 6 ++++++
NEWS | 1 +
plugins/plot_radar/gog-radar.c | 17 +++++++++++------
3 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e50898b..083e626 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-25 Morten Welinder <terra gnome org>
+
+ * plugins/plot_radar/gog-radar.c (gog_rt_plot_update): Handle log
+ radial axis better.
+ (gog_polar_plot_axis_get_bounds): Ditto.
+
2015-03-24 Morten Welinder <terra gnome org>
* plugins/plot_barcol/gog-1.5d.c (gog_plot1_5d_axis_get_bounds):
diff --git a/NEWS b/NEWS
index d85cc6b..7f60a6c 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Morten:
* Improve log axis bounds.
* Fix format used for stacked percentage graphs.
* Don't force bar/col axis to include 0 for log axis.
+ * Don't force radial plots to include 0 for log axis.
--------------------------------------------------------------------------
goffice 0.10.21:
diff --git a/plugins/plot_radar/gog-radar.c b/plugins/plot_radar/gog-radar.c
index 3bcb466..7dc85d2 100644
--- a/plugins/plot_radar/gog-radar.c
+++ b/plugins/plot_radar/gog-radar.c
@@ -159,6 +159,7 @@ gog_rt_plot_update (GogObject *obj)
double val_min, val_max, tmp_min, tmp_max;
GSList *ptr;
GogErrorBar *errors;
+ GogAxis *raxis = model->base.axis[GOG_AXIS_RADIAL];
val_min = DBL_MAX;
val_max = -DBL_MAX;
@@ -169,7 +170,7 @@ gog_rt_plot_update (GogObject *obj)
if (num_elements < series->base.num_elements)
num_elements = series->base.num_elements;
- go_data_get_bounds (series->base.values[1].data, &tmp_min, &tmp_max);
+ gog_axis_data_get_bounds (raxis, series->base.values[1].data, &tmp_min, &tmp_max);
if (val_min > tmp_min) val_min = tmp_min;
if (val_max < tmp_max) val_max = tmp_max;
@@ -187,7 +188,7 @@ gog_rt_plot_update (GogObject *obj)
if (model->r.minima != val_min || model->r.maxima != val_max) {
model->r.minima = val_min;
model->r.maxima = val_max;
- gog_axis_bound_changed (model->base.axis [GOG_AXIS_RADIAL], GOG_OBJECT (model));
+ gog_axis_bound_changed (raxis, GOG_OBJECT (model));
}
model->t.minima = 1;
@@ -479,25 +480,29 @@ gog_polar_plot_type_name (G_GNUC_UNUSED GogObject const *item)
}
static GOData *
-gog_polar_plot_axis_get_bounds (GogPlot *plot, GogAxisType axis,
+gog_polar_plot_axis_get_bounds (GogPlot *plot, GogAxisType atype,
GogPlotBoundInfo * bounds)
{
GogRTPlot *rt = GOG_RT_PLOT (plot);
+ GogAxis *axis = gog_plot_get_axis (plot, atype);
- switch (axis) {
+ switch (atype) {
case GOG_AXIS_CIRCULAR:
bounds->val.minima = bounds->logical.minima= -G_MAXDOUBLE;
bounds->val.maxima = bounds->logical.maxima= G_MAXDOUBLE;
bounds->is_discrete = FALSE;
break;
case GOG_AXIS_RADIAL:
- bounds->val.minima = bounds->logical.minima = 0.;
+ bounds->val.minima = bounds->logical.minima =
+ gog_axis_is_zero_important (axis)
+ ? 0.0
+ : rt->r.minima;
bounds->val.maxima = rt->r.maxima;
bounds->logical.maxima = go_nan;
bounds->is_discrete = FALSE;
break;
default:
- g_warning("[GogPolarPlot::axis_set_bounds] bad axis (%i)", axis);
+ g_warning("[GogPolarPlot::axis_set_bounds] bad axis (%i)", atype);
break;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]