Browse Source

Small last fixes

pull/264/head
Florian Mounier 10 years ago
parent
commit
ecff6f5a7b
  1. 1
      demo/moulinrouge/tests.py
  2. 7
      docs/api/pygal.adapters.rst
  3. 2
      pygal/graph/graph.py
  4. 14
      pygal/graph/stackedbar.py
  5. 2
      pygal/style.py

1
demo/moulinrouge/tests.py

@ -475,6 +475,7 @@ def get_test_routes(app):
@app.route('/test/worldmap')
def test_worldmap():
wmap = world.World(print_values=True, style=choice(list(styles.values())))
# wmap.js = ('http://l:2343/2.0.x/pygal-tooltips.js',)
wmap.add('1st', [('fr', 100), {
'value': ('us', 10),
'node': {'style': 'fill: red'}

7
docs/api/pygal.adapters.rst

@ -0,0 +1,7 @@
pygal.adapters module
=====================
.. automodule:: pygal.adapters
:members:
:undoc-members:
:show-inheritance:

2
pygal/graph/graph.py

@ -151,6 +151,8 @@ class Graph(PublicApi):
continue
guides = self.svg.node(axis, class_='guides')
x = self.view.x(position)
if x is None:
continue
y = self.view.height + 5
last_guide = (self._y_2nd_labels and label == lastlabel)
self.svg.node(

14
pygal/graph/stackedbar.py

@ -50,18 +50,22 @@ class StackedBar(Bar):
def _compute_box(self, positive_vals, negative_vals):
"""Compute Y min and max"""
self._box.ymin = negative_vals and min(min(negative_vals), self.zero)
self._box.ymax = positive_vals and max(max(positive_vals), self.zero)
self._box.ymin = negative_vals and min(
min(negative_vals), self.zero) or self.zero
self._box.ymax = positive_vals and max(
max(positive_vals), self.zero) or self.zero
def _compute(self):
"""Compute y min and max and y scale and set labels"""
positive_vals, negative_vals = self._get_separated_values()
self._compute_box(positive_vals, negative_vals)
if self.logarithmic:
positive_vals = list(filter(lambda x: x > 0, positive_vals))
negative_vals = list(filter(lambda x: x > 0, negative_vals))
positive_vals = list(filter(
lambda x: x > self.zero, positive_vals))
negative_vals = list(filter(
lambda x: x > self.zero, negative_vals))
self._compute_box(positive_vals, negative_vals)
positive_vals = positive_vals or [self.zero]
negative_vals = negative_vals or [self.zero]

2
pygal/style.py

@ -51,7 +51,7 @@ class Style(object):
label_font_size = 10
major_label_font_size = 10
value_font_size = 8
tooltip_font_size = 16
tooltip_font_size = 14
title_font_size = 16
legend_font_size = 14
no_data_font_size = 64

Loading…
Cancel
Save