Browse Source

Fix secondary values

pull/136/head
Florian Mounier 11 years ago
parent
commit
cb9174cb18
  1. 6
      pygal/ghost.py
  2. 4
      pygal/util.py

6
pygal/ghost.py

@ -85,8 +85,8 @@ class Ghost(object):
def add_xml_filter(self, callback):
self.xml_filters.append(callback)
def make_series(self, series):
return prepare_values(series, self.config, self.cls)
def make_series(self, series, offset=0):
return prepare_values(series, self.config, self.cls, offset)
def make_instance(self, overrides=None):
for conf_key in CONFIG_ITEMS:
@ -98,7 +98,7 @@ class Ghost(object):
self.config(**self.__dict__)
self.config.__dict__.update(overrides or {})
series = self.make_series(self.raw_series)
secondary_series = self.make_series(self.raw_series2)
secondary_series = self.make_series(self.raw_series2, len(series))
self._last__inst = self.cls(
self.config, series, secondary_series, self.uuid,
self.xml_filters)

4
pygal/util.py

@ -319,7 +319,7 @@ def safe_enumerate(iterable):
yield i, v
def prepare_values(raw, config, cls):
def prepare_values(raw, config, cls, offset=0):
"""Prepare the values to start with sane values"""
from pygal.serie import Serie
from pygal.config import SerieConfig
@ -404,7 +404,7 @@ def prepare_values(raw, config, cls):
serie_config(**config.to_dict())
serie_config(**serie_config_kwargs)
series.append(
Serie(len(series), title, values, serie_config, metadata))
Serie(offset + len(series), title, values, serie_config, metadata))
return series

Loading…
Cancel
Save