Browse Source

Fix y_labels map iterator exhaustion in python 3

pull/102/merge
Florian Mounier 11 years ago
parent
commit
7627fb40a2
  1. 3
      CHANGELOG
  2. 10
      demo/moulinrouge/tests.py
  3. 2
      pygal/__init__.py
  4. 2
      pygal/graph/box.py
  5. 2
      pygal/graph/funnel.py
  6. 2
      pygal/graph/line.py
  7. 2
      pygal/graph/radar.py
  8. 2
      pygal/graph/stackedbar.py

3
CHANGELOG

@ -1,3 +1,6 @@
V 1.4.5
Fix y_labels map iterator exhaustion in python 3
V 1.4.4
Fix division by zero in spark text (thanks laserpony)
Fix config metaclass problem in python 3

10
demo/moulinrouge/tests.py

@ -256,6 +256,16 @@ def get_test_routes(app):
hist.add('2', [(2, 2, 8)])
return hist.render_response()
@app.route('/test/ylabels')
def test_ylabels():
chart = Line()
chart.x_labels = 'Red', 'Blue', 'Green'
chart.y_labels = .0001, .0003, .0004, .00045, .0005
chart.add('line', [.0002, .0005, .00035])
return chart.render_response()
@app.route('/test/secondary/<chart>')
def test_secondary_for(chart):
chart = CHARTS_BY_NAME[chart](fill=True)

2
pygal/__init__.py

@ -21,7 +21,7 @@ Pygal - A python svg graph plotting library
"""
__version__ = '1.4.4'
__version__ = '1.4.5'
import sys
from pygal.config import Config
from pygal.ghost import Ghost, REAL_CHARTS

2
pygal/graph/box.py

@ -74,7 +74,7 @@ class Box(Graph):
y_pos = compute_scale(
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min
) if not self.y_labels else map(float, self.y_labels)
) if not self.y_labels else list(map(float, self.y_labels))
self._x_labels = self.x_labels and list(zip(self.x_labels, [
(i + .5) / self._order for i in range(self._order)]))

2
pygal/graph/funnel.py

@ -85,7 +85,7 @@ class Funnel(Graph):
y_pos = compute_scale(
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min
) if not self.y_labels else map(float, self.y_labels)
) if not self.y_labels else list(map(float, self.y_labels))
self._x_labels = list(
zip(cut(self.series, 'title'),

2
pygal/graph/line.py

@ -131,7 +131,7 @@ class Line(Graph):
y_pos = compute_scale(
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min
) if not self.y_labels else map(float, self.y_labels)
) if not self.y_labels else list(map(float, self.y_labels))
self._y_labels = list(zip(map(self._format, y_pos), y_pos))

2
pygal/graph/radar.py

@ -182,7 +182,7 @@ class Radar(Line):
y_pos = compute_scale(
self._rmin, self._rmax, self.logarithmic, self.order_min,
max_scale=8
) if not self.y_labels else map(int, self.y_labels)
) if not self.y_labels else list(map(int, self.y_labels))
self._x_labels = self.x_labels and list(zip(self.x_labels, x_pos))
self._y_labels = list(zip(map(self._format, y_pos), y_pos))

2
pygal/graph/stackedbar.py

@ -68,7 +68,7 @@ class StackedBar(Bar):
self._points(x_pos)
y_pos = compute_scale(
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min
) if not self.y_labels else map(float, self.y_labels)
) if not self.y_labels else list(map(float, self.y_labels))
self._x_ranges = zip(x_pos, x_pos[1:])
self._x_labels = self.x_labels and list(zip(self.x_labels, [

Loading…
Cancel
Save