diff --git a/pygal/config.py b/pygal/config.py index 0fd2410..bf8923d 100644 --- a/pygal/config.py +++ b/pygal/config.py @@ -40,12 +40,12 @@ class Config(object): #: Display values in logarithmic scale logarithmic = False #: List of css file, can be an absolute file path or an external link - css = ['style.css', 'graph.css'] # Relative path to pygal css + css = ('style.css', 'graph.css') # Relative path to pygal css #: List of js file, can be a filepath or an external link - js = [ + js = ( 'https://raw.github.com/Kozea/pygal.js/master/svg.jquery.js', 'https://raw.github.com/Kozea/pygal.js/master/pygal-tooltips.js' - ] + ) #: Style holding values injected in css style = DefaultStyle #: Various font sizes @@ -105,6 +105,8 @@ class Config(object): def __init__(self, **kwargs): """Can be instanciated with config kwargs""" + self.css = list(self.css) + self.js = list(self.js) self.__dict__.update(kwargs) def __call__(self, **kwargs): diff --git a/pygal/css/base.css b/pygal/css/base.css index 5391838..d79efd4 100644 --- a/pygal/css/base.css +++ b/pygal/css/base.css @@ -23,7 +23,7 @@ */ .title { - font-family: monospace; + font-family: sans; font-size: {{ font_sizes.title }}; } diff --git a/pygal/css/graph.css b/pygal/css/graph.css index 6e65b12..d5174aa 100644 --- a/pygal/css/graph.css +++ b/pygal/css/graph.css @@ -22,7 +22,7 @@ text.no_data { text-anchor: middle; } -.line { +.guide.line { fill-opacity: 0; } diff --git a/pygal/graph/base.py b/pygal/graph/base.py index 9fa7f94..6ee0442 100644 --- a/pygal/graph/base.py +++ b/pygal/graph/base.py @@ -54,7 +54,7 @@ class BaseGraph(object): def add(self, title, values): """Add a serie to this graph""" self.series.append( - Serie(title, list(values), len(self.series), self.__value__)) + Serie(title, values, len(self.series), self.__value__)) def reinit(self): """(Re-)Init the graph""" diff --git a/pygal/graph/dot.py b/pygal/graph/dot.py index ada637d..207c803 100644 --- a/pygal/graph/dot.py +++ b/pygal/graph/dot.py @@ -62,7 +62,7 @@ class Dot(Graph): self._box.ymax = y_len x_pos = [n / 2 for n in range(1, 2 * x_len, 2)] - y_pos = [n / 2 for n in range(1, 2 * y_len, 2)] + y_pos = [n / 2 for n in reversed(range(1, 2 * y_len, 2))] for j, serie in enumerate(self.series): serie.points = [ diff --git a/pygal/graph/xy.py b/pygal/graph/xy.py index 80d280e..a803e91 100644 --- a/pygal/graph/xy.py +++ b/pygal/graph/xy.py @@ -33,6 +33,11 @@ class XY(Line): return 'x=%s, y=%s' % tuple(map(self._format, values[i])) def _compute(self): + for serie in self.series: + for metadata in serie.metadata: + if not hasattr(metadata.value, '__iter__'): + metadata.value = (metadata.value, self.zero) + xvals = [val[0] for serie in self.series for val in serie.values diff --git a/pygal/test/test_graph.py b/pygal/test/test_graph.py index 88309e9..72e867b 100644 --- a/pygal/test/test_graph.py +++ b/pygal/test/test_graph.py @@ -62,6 +62,12 @@ def test_render_to_png(Chart, datas): os.remove(file_name) +def test_simple_value(Chart): + chart = Chart() + chart.add('uni-value', 1) + assert chart.render() + + def test_metadata(Chart): chart = Chart() v = range(7) diff --git a/pygal/util.py b/pygal/util.py index 5c3cc70..3924cbc 100644 --- a/pygal/util.py +++ b/pygal/util.py @@ -196,7 +196,7 @@ def decorate(svg, node, metadata): if hasattr(metadata, 'xlink'): xlink = metadata.xlink if not isinstance(xlink, dict): - xlink = {'href': xlink} + xlink = {'href': xlink, 'target': '_blank'} node = svg.node(node, 'a', **xlink) for key in dir(metadata): if key not in ('value') and not key.startswith('_'):