From 28037d95bda22e4d9a38b8f0c657b76b7f635a63 Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Mon, 31 Aug 2015 11:12:58 +0200 Subject: [PATCH] Fix x labels formatting --- docs/changelog.rst | 6 ++++++ pygal/__init__.py | 2 +- pygal/graph/funnel.py | 3 +-- pygal/graph/graph.py | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index b606681..400c272 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,6 +2,12 @@ Changelog ========= +2.0.5 +===== + +* Fix x label formatting + + 2.0.4 ===== diff --git a/pygal/__init__.py b/pygal/__init__.py index eaac228..907ab90 100644 --- a/pygal/__init__.py +++ b/pygal/__init__.py @@ -24,7 +24,7 @@ and the maps extensions namespace module. """ -__version__ = '2.0.4' +__version__ = '2.0.5' import pkg_resources import sys diff --git a/pygal/graph/funnel.py b/pygal/graph/funnel.py index e38243e..1b3d94e 100644 --- a/pygal/graph/funnel.py +++ b/pygal/graph/funnel.py @@ -23,7 +23,6 @@ from __future__ import division from pygal.adapters import none_to_zero, positive from pygal.graph.graph import Graph from pygal.util import alter, cut, decorate -from pygal._compat import to_str class Funnel(Graph): @@ -95,7 +94,7 @@ class Funnel(Graph): def _compute_x_labels(self): self._x_labels = list( zip(self.x_labels and - map(to_str, self.x_labels) or [ + map(self._x_format, self.x_labels) or [ serie.title['title'] if isinstance(serie.title, dict) else serie.title for serie in self.series], diff --git a/pygal/graph/graph.py b/pygal/graph/graph.py index 12eddf8..555fe62 100644 --- a/pygal/graph/graph.py +++ b/pygal/graph/graph.py @@ -173,7 +173,7 @@ class Graph(PublicApi): text.text = truncate(label, truncation) if text.text != label: self.svg.node(guides, 'title').text = label - else: + elif self._dual: self.svg.node( guides, 'title', ).text = self._x_format(position) @@ -748,7 +748,7 @@ class Graph(PublicApi): def _compute_x_labels(self): self._x_labels = self.x_labels and list( - zip(map(to_str, self.x_labels), self._x_pos)) + zip(map(self._x_format, self.x_labels), self._x_pos)) def _compute_y_labels(self): y_pos = compute_scale(