Browse Source

Fix x labels formatting

pull/264/head
Florian Mounier 9 years ago
parent
commit
28037d95bd
  1. 6
      docs/changelog.rst
  2. 2
      pygal/__init__.py
  3. 3
      pygal/graph/funnel.py
  4. 4
      pygal/graph/graph.py

6
docs/changelog.rst

@ -2,6 +2,12 @@
Changelog Changelog
========= =========
2.0.5
=====
* Fix x label formatting
2.0.4 2.0.4
===== =====

2
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 pkg_resources
import sys import sys

3
pygal/graph/funnel.py

@ -23,7 +23,6 @@ from __future__ import division
from pygal.adapters import none_to_zero, positive from pygal.adapters import none_to_zero, positive
from pygal.graph.graph import Graph from pygal.graph.graph import Graph
from pygal.util import alter, cut, decorate from pygal.util import alter, cut, decorate
from pygal._compat import to_str
class Funnel(Graph): class Funnel(Graph):
@ -95,7 +94,7 @@ class Funnel(Graph):
def _compute_x_labels(self): def _compute_x_labels(self):
self._x_labels = list( self._x_labels = list(
zip(self.x_labels and zip(self.x_labels and
map(to_str, self.x_labels) or [ map(self._x_format, self.x_labels) or [
serie.title['title'] serie.title['title']
if isinstance(serie.title, dict) if isinstance(serie.title, dict)
else serie.title for serie in self.series], else serie.title for serie in self.series],

4
pygal/graph/graph.py

@ -173,7 +173,7 @@ class Graph(PublicApi):
text.text = truncate(label, truncation) text.text = truncate(label, truncation)
if text.text != label: if text.text != label:
self.svg.node(guides, 'title').text = label self.svg.node(guides, 'title').text = label
else: elif self._dual:
self.svg.node( self.svg.node(
guides, 'title', guides, 'title',
).text = self._x_format(position) ).text = self._x_format(position)
@ -748,7 +748,7 @@ class Graph(PublicApi):
def _compute_x_labels(self): def _compute_x_labels(self):
self._x_labels = self.x_labels and list( 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): def _compute_y_labels(self):
y_pos = compute_scale( y_pos = compute_scale(

Loading…
Cancel
Save