[goffice] Use data format for discrete axis. [#641901]
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Use data format for discrete axis. [#641901]
- Date: Fri, 2 Sep 2011 15:28:40 +0000 (UTC)
commit 0b21c3816fd1abf8a8fb9834f84678f3064a1534
Author: Jean Brefort <jean brefort normalesup org>
Date: Fri Sep 2 17:23:44 2011 +0200
Use data format for discrete axis. [#641901]
ChangeLog | 4 ++++
NEWS | 1 +
goffice/graph/gog-axis.c | 21 ++++++++++++++-------
3 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 12fd3ff..075a109 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-02 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/graph/gog-axis.c: use data format for discrete axis. [#641901]
+
2011-09-02 Andreas J. Guelzow <aguelzow pyrshep ca>
* goffice/utils/go-format.c (si_reduction): use -24 for smaller
diff --git a/NEWS b/NEWS
index f6180d1..81d3454 100644
--- a/NEWS
+++ b/NEWS
@@ -24,6 +24,7 @@ Jean:
chart. [#657696]
* Don't crash when pseudo3d axis has too large manual ticks
spacing. [#657695]
+ * Use data format for discrete axis. [#641901]
Morten:
* Recognize scientific formats with longer exponents.
diff --git a/goffice/graph/gog-axis.c b/goffice/graph/gog-axis.c
index bf67b80..12429e3 100644
--- a/goffice/graph/gog-axis.c
+++ b/goffice/graph/gog-axis.c
@@ -393,17 +393,24 @@ map_discrete_calc_ticks (GogAxis *axis)
if (axis->labels != NULL) {
if (index < (int) go_data_get_vector_size (axis->labels) && index >= 0) {
PangoAttrList *l = go_data_get_vector_markup (axis->labels, index);
- label = go_data_get_vector_string (axis->labels, index);
- if (l != NULL)
+ if (l != NULL) {
+ label = go_data_get_vector_string (axis->labels, index);
gog_axis_ticks_set_markup (&ticks[j], label, l);
- else
- gog_axis_ticks_set_text (&ticks[j], label);
- g_free (label);
+ g_free (label);
+ } else {
+ double val = go_data_get_vector_value (axis->labels, index);
+ if (go_finite (val))
+ axis_format_value (axis, val, &ticks[j].str);
+ else {
+ label = go_data_get_vector_string (axis->labels, index);
+ gog_axis_ticks_set_text (&ticks[j], label);
+ g_free (label);
+ }
+ }
}
} else {
label = g_strdup_printf ("%d", index + 1);
gog_axis_ticks_set_text (&ticks[j], label);
- g_free (label);
}
}
@@ -2635,7 +2642,7 @@ gog_axis_populate_editor (GogObject *gobj,
(GOG_OBJECT_CLASS(parent_klass)->populate_editor) (gobj, editor, dalloc, cc);
/* Format page */
- if (!axis->is_discrete) {
+ {
GOFormat *fmt = gog_axis_get_effective_format (axis);
w = go_format_sel_new_full (TRUE);
state->format_selector = w;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]