Browse Source

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'
```
pull/39/head
Nathan Villaescusa 12 years ago
parent
commit
75c83b07f8
  1. 8
      pygal/graph/line.py

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

Loading…
Cancel
Save