Browse Source

Multipel fix

pull/8/head
Florian Mounier 13 years ago
parent
commit
95192d37e9
  1. 8
      pygal/config.py
  2. 2
      pygal/css/base.css
  3. 2
      pygal/css/graph.css
  4. 2
      pygal/graph/base.py
  5. 2
      pygal/graph/dot.py
  6. 5
      pygal/graph/xy.py
  7. 6
      pygal/test/test_graph.py
  8. 2
      pygal/util.py

8
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):

2
pygal/css/base.css

@ -23,7 +23,7 @@
*/
.title {
font-family: monospace;
font-family: sans;
font-size: {{ font_sizes.title }};
}

2
pygal/css/graph.css

@ -22,7 +22,7 @@ text.no_data {
text-anchor: middle;
}
.line {
.guide.line {
fill-opacity: 0;
}

2
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"""

2
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 = [

5
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

6
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)

2
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('_'):

Loading…
Cancel
Save