Skip to content

Commit

Permalink
Fix y_labels map iterator exhaustion in python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
paradoxxxzero committed Mar 5, 2014
1 parent ed3148b commit 7627fb4
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 10 additions & 0 deletions demo/moulinrouge/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,16 @@ def test_histogram():
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)
Expand Down
2 changes: 1 addition & 1 deletion pygal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"""

__version__ = '1.4.4'
__version__ = '1.4.5'
import sys
from pygal.config import Config
from pygal.ghost import Ghost, REAL_CHARTS
Expand Down
2 changes: 1 addition & 1 deletion pygal/graph/box.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _compute(self):

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)]))
Expand Down
2 changes: 1 addition & 1 deletion pygal/graph/funnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _compute(self):

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'),
Expand Down
2 changes: 1 addition & 1 deletion pygal/graph/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _compute(self):

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))

Expand Down
2 changes: 1 addition & 1 deletion pygal/graph/radar.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def _compute(self):
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))
Expand Down
2 changes: 1 addition & 1 deletion pygal/graph/stackedbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _compute(self):
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, [
Expand Down

0 comments on commit 7627fb4

Please sign in to comment.