Browse Source

Fix #148

pull/219/merge
Florian Mounier 10 years ago
parent
commit
2dda376a0e
  1. 2
      CHANGELOG
  2. 10
      pygal/graph/graph.py

2
CHANGELOG

@ -3,6 +3,8 @@ V 2.0.0 UNRELEASED
Refactor maps
Add swiss cantons map (thanks sergedroz)
Add inverse_y_axis options to reverse graph (#24)
Fix DateTimeLine time data loss (#193)
Fix no data for graphs with only zeroes (#148)
V 1.7.0
Remove DateY and replace it by real XY datetime, date, time and timedelta support. (#188)

10
pygal/graph/graph.py

@ -22,6 +22,7 @@ Commmon graphing functions
"""
from __future__ import division
from pygal._compat import is_list_like
from pygal.interpolate import INTERPOLATIONS
from pygal.graph.base import BaseGraph
from pygal.view import View, LogView, XYLogView, ReverseView
@ -710,13 +711,14 @@ class Graph(BaseGraph):
self._post_compute()
self._compute_margin()
self._decorate()
if self.series and self._has_data():
if self.series and self._has_data() and self._values:
self._plot()
else:
self.svg.draw_no_data()
def _has_data(self):
"""Check if there is any data"""
return sum(
map(len, map(lambda s: s.safe_values, self.series))) != 0 and (
sum(map(abs, self._values)) != 0)
return any([
len([v for v in (s[1] if is_list_like(s) else [s]) if v is not None])
for s in self.raw_series
])

Loading…
Cancel
Save