Browse Source

Avoid x label formatting when label is a string

pull/264/head 2.0.6
Florian Mounier 9 years ago
parent
commit
f3c6b1bd85
  1. 2
      demo/moulinrouge/tests.py
  2. 5
      docs/changelog.rst
  3. 2
      pygal/__init__.py
  4. 8
      pygal/graph/graph.py

2
demo/moulinrouge/tests.py

@ -37,7 +37,7 @@ def get_test_routes(app):
@app.route('/test/unsorted')
def test_unsorted():
bar = Bar(style=styles['neon'])
bar = Bar(style=styles['neon'], human_readable=True)
bar.add('A', {'red': 10, 'green': 12, 'blue': 14})
bar.add('B', {'green': 11, 'blue': 7})
bar.add('C', {'blue': 7})

5
docs/changelog.rst

@ -2,6 +2,11 @@
Changelog
=========
2.0.6
=====
* Avoid x label formatting when label is a string
2.0.5
=====

2
pygal/__init__.py

@ -24,7 +24,7 @@ and the maps extensions namespace module.
"""
__version__ = '2.0.5'
__version__ = '2.0.6'
import pkg_resources
import sys

8
pygal/graph/graph.py

@ -747,8 +747,14 @@ class Graph(PublicApi):
)
def _compute_x_labels(self):
def format_if_value(label):
if not is_str(label):
return self._x_format(label)
return label
self._x_labels = self.x_labels and list(
zip(map(self._x_format, self.x_labels), self._x_pos))
zip(map(format_if_value, self.x_labels), self._x_pos))
def _compute_y_labels(self):
y_pos = compute_scale(

Loading…
Cancel
Save