From 75c83b07f86e1be72ca1a3f8ffa20e37b5c76843 Mon Sep 17 00:00:00 2001 From: Nathan Villaescusa Date: Wed, 19 Jun 2013 19:22:46 -0600 Subject: [PATCH] Fix bug with None y-values for charts with a secondary y-axis. Otherwise the following exception is thrown: ``` Exception: unsupported operand type(s) for -: 'NoneType' and 'float' ``` --- pygal/graph/line.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pygal/graph/line.py b/pygal/graph/line.py index 84348aa..846be00 100644 --- a/pygal/graph/line.py +++ b/pygal/graph/line.py @@ -60,9 +60,11 @@ class Line(Graph): def line(self, serie_node, serie, rescale=False): """Draw the line serie""" if rescale and self.secondary_series: - points = [ - (x, self._scale_diff + (y - self._scale_min_2nd) * self._scale) - for x, y in serie.points] + points = [] + for x, y in serie.points: + if y is not None: + y = self._scale_diff + (y - self._scale_min_2nd) * self._scale + points.append((x, y)) else: points = serie.points view_values = list(map(self.view, points))