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