Browse Source

Fix stacked lines

pull/8/head
Florian Mounier 13 years ago
parent
commit
f72e2a7446
  1. 4
      pygal/graph/base.py
  2. 1
      pygal/graph/line.py
  3. 5
      pygal/graph/stackedline.py
  4. 4
      pygal/style.py

4
pygal/graph/base.py

@ -177,6 +177,10 @@ class BaseGraph(object):
diff = self._len - len(serie.values)
serie.metadata += diff * [self.__value__(0)]
for metadata in serie.metadata:
if metadata.value == None:
metadata.value = 0
def _render(self):
"""Make the graph internally"""
self.reinit()

1
pygal/graph/line.py

@ -99,6 +99,7 @@ class Line(Graph):
] if self._len != 1 else [.5] # Center if only one value
for serie in self.series:
if not hasattr(serie, 'points'):
serie.points = [
(x_pos[i], v)
for i, v in enumerate(serie.values)]

5
pygal/graph/stackedline.py

@ -46,10 +46,7 @@ class StackedLine(Line):
] if self._len != 1 else [.5] # Center if only one value
accumulation = [0] * self._len
for serie in self.series:
accumulation = map(sum, izip_longest(
accumulation, [val
if val != None else 0
for val in serie.values], fillvalue=0))
accumulation = map(sum, zip(accumulation, serie.values))
serie.points = [
(x_pos[i], v)
for i, v in enumerate(accumulation)]

4
pygal/style.py

@ -35,8 +35,8 @@ class Style(object):
transition='250ms',
colors=(
'#ff5995', '#b6e354', '#feed6c', '#8cedff', '#9e6ffe',
'#899ca1', '#f8f8f2', '#808384', '#bf4646', '#516083',
'#f92672', '#82b414', '#fd971f', '#56c2d6', '#8c54fe',
'#899ca1', '#f8f8f2', '#bf4646', '#516083', '#f92672',
'#82b414', '#fd971f', '#56c2d6', '#808384', '#8c54fe',
'#465457')):
self.background = background
self.plot_background = plot_background

Loading…
Cancel
Save