Browse Source

Fix #178

pull/264/head
Florian Mounier 10 years ago
parent
commit
4bfbd4f129
  1. 3
      demo/moulinrouge/tests.py
  2. 1
      docs/changelog.rst
  3. 4
      pygal/graph/funnel.py
  4. 2
      pygal/graph/graph.py

3
demo/moulinrouge/tests.py

@ -50,7 +50,7 @@ def get_test_routes(app):
def test_bar_links(): def test_bar_links():
bar = StackedLine(style=styles['default']( bar = StackedLine(style=styles['default'](
font_family='googlefont:Raleway')) font_family='googlefont:Raleway'))
bar.js = ('http://l:2343/2.0.x/pygal-tooltips.js',) # bar.js = ('http://l:2343/2.0.x/pygal-tooltips.js',)
bar.title = 'Wow ! Such Chart !' bar.title = 'Wow ! Such Chart !'
bar.x_title = 'Many x labels' bar.x_title = 'Many x labels'
bar.y_title = 'Much y labels' bar.y_title = 'Much y labels'
@ -142,6 +142,7 @@ def get_test_routes(app):
def test_bar_none(): def test_bar_none():
bar = Bar() bar = Bar()
bar.add('Lol', [2, None, 12]) bar.add('Lol', [2, None, 12])
bar.x_labels = range(1, 4)
return bar.render_response() return bar.render_response()
@app.route('/test/print_values') @app.route('/test/print_values')

1
docs/changelog.rst

@ -6,6 +6,7 @@ Changelog
================ ================
* Fix the missing title on x_labels with labels. * Fix the missing title on x_labels with labels.
* Auto cast to str x labels in non dual charts (#178)
2.0.0 2.0.0
===== =====

4
pygal/graph/funnel.py

@ -23,6 +23,7 @@ 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):
@ -93,7 +94,8 @@ 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 or [ zip(self.x_labels and
map(to_str, 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],

2
pygal/graph/graph.py

@ -735,7 +735,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(self.x_labels, self._x_pos)) zip(map(to_str, 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