[goffice] Don't loose any data in an histogram when using automatic bins. [#742996]
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Don't loose any data in an histogram when using automatic bins. [#742996]
- Date: Fri, 16 Jan 2015 17:50:32 +0000 (UTC)
commit bf52262f6bcee4e765cee50c13e06d6884fc90ed
Author: Jean Brefort <jean brefort normalesup org>
Date: Fri Jan 16 18:50:08 2015 +0100
Don't loose any data in an histogram when using automatic bins. [#742996]
ChangeLog | 6 ++++++
NEWS | 1 +
plugins/plot_distrib/gog-histogram.c | 7 +++++--
3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1e1e72c..8cf62af 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-01-16 Jean Brefort <jean brefort normalesup org>
+
+ * plugins/plot_distrib/gog-histogram.c
+ (gog_histogram_plot_series_update): don't loose any data when using
+ automatic bins. [#742996]
+
2015-01-14 Jean Brefort <jean brefort normalesup org>
* plugins/reg_linear/gog-lin-reg.c (gog_lin_reg_curve_update): protect
diff --git a/NEWS b/NEWS
index ea9c4b5..4b14230 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Jean:
* Implement canvas native scrolling. [#741394]
* Don't use a data vector with no valid value. [#741910]
* Allow custom ticks and grid lines for axis lines. [#600482]
+ * Don't loose any data in an histogram when using automatic bins. [#742996]
Morten:
* Dead kitten salvage.
diff --git a/plugins/plot_distrib/gog-histogram.c b/plugins/plot_distrib/gog-histogram.c
index f564fa2..6d4a8ea 100644
--- a/plugins/plot_distrib/gog-histogram.c
+++ b/plugins/plot_distrib/gog-histogram.c
@@ -1004,7 +1004,7 @@ gog_histogram_plot_series_update (GogObject *obj)
}
}
if (width > 0. && (y || y_)) {
- double m, M;
+ double m, M, nm;
/* ignore nans */
if (y) {
m = y_ ? (MIN (y[0], y_[0])) : y[0];
@@ -1016,7 +1016,10 @@ gog_histogram_plot_series_update (GogObject *obj)
if (!go_finite (m) || !go_finite (M))
return;
/* round m */
- m = floor ((m - origin)/ width) * width + origin;
+ nm = floor ((m - origin)/ width) * width + origin;
+ /* we need to include all data so we must ensure that the
+ * first bin must be lower than the first value, see #742996 */
+ m = (nm == m)? nm - width: nm;
x_len = ceil ((M - m) / width) + 1;
series->real_x = g_new (double, x_len);
for (max = 0; max < x_len; max++) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]