From a88bbf736649c25c0c59999f09e77c998e991344 Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Mon, 24 Jun 2013 11:00:10 +0200 Subject: [PATCH] Fix for python 3 too --- pygal/graph/bar.py | 6 +++--- pygal/graph/graph.py | 2 +- pygal/graph/stackedbar.py | 8 ++++---- pygal/graph/verticalpyramid.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pygal/graph/bar.py b/pygal/graph/bar.py index 2f3cf5c..2bd352b 100644 --- a/pygal/graph/bar.py +++ b/pygal/graph/bar.py @@ -106,12 +106,12 @@ class Bar(Graph): def _compute_secondary(self): if self.secondary_series: - y_pos = zip(*self._y_labels)[1] + y_pos = list(zip(*self._y_labels))[1] ymin = self._secondary_min ymax = self._secondary_max - min_0_ratio = (self.zero - self._box.ymin) / self._box.height - max_0_ratio = (self._box.ymax - self.zero) / self._box.height + min_0_ratio = (self.zero - self._box.ymin) / self._box.height or 1 + max_0_ratio = (self._box.ymax - self.zero) / self._box.height or 1 new_ymax = (self.zero - ymin) * (1 / min_0_ratio - 1) new_ymin = -(ymax - self.zero) * (1 / max_0_ratio - 1) diff --git a/pygal/graph/graph.py b/pygal/graph/graph.py index f77afd3..8ecc857 100644 --- a/pygal/graph/graph.py +++ b/pygal/graph/graph.py @@ -463,7 +463,7 @@ class Graph(BaseGraph): def _compute_secondary(self): # secondary y axis support if self.secondary_series and self._y_labels: - y_pos = zip(*self._y_labels)[1] + y_pos = list(zip(*self._y_labels))[1] if self.include_x_axis: ymin = min(self._secondary_min, 0) ymax = max(self._secondary_max, 0) diff --git a/pygal/graph/stackedbar.py b/pygal/graph/stackedbar.py index bb8a3c1..610eacb 100644 --- a/pygal/graph/stackedbar.py +++ b/pygal/graph/stackedbar.py @@ -85,10 +85,10 @@ class StackedBar(Bar): # In case of pyramids sum_ = lambda x: sum(x) if isinstance(x, tuple) else x - self._secondary_min = negative_vals and min( - sum_(min(negative_vals)), self.zero) - self._secondary_max = positive_vals and max( - sum_(max(positive_vals)), self.zero) + self._secondary_min = (negative_vals and min( + sum_(min(negative_vals)), self.zero)) or self.zero + self._secondary_max = (positive_vals and max( + sum_(max(positive_vals)), self.zero)) or self.zero def _bar(self, parent, x, y, index, i, zero, shift=False, secondary=False): if secondary: diff --git a/pygal/graph/verticalpyramid.py b/pygal/graph/verticalpyramid.py index 308fb76..7afb92f 100644 --- a/pygal/graph/verticalpyramid.py +++ b/pygal/graph/verticalpyramid.py @@ -54,7 +54,7 @@ class VerticalPyramid(StackedBar): def _compute_secondary(self): # Need refactoring if self.secondary_series: - y_pos = zip(*self._y_labels)[1] + y_pos = list(zip(*self._y_labels))[1] positive_vals, negative_vals = self._get_separated_values(True) positive_sum = map(sum, positive_vals) or [self.zero] negative_sum = map(sum, negative_vals) or [self.zero]