Browse Source

Fix new codestyle

pull/339/head
Florian Mounier 8 years ago
parent
commit
4ff6debb01
  1. 4
      pygal/graph/box.py
  2. 3
      pygal/graph/graph.py
  3. 12
      pygal/graph/solidgauge.py
  4. 4
      pygal/test/test_config.py

4
pygal/graph/box.py

@ -49,8 +49,8 @@ class Box(Graph):
""" """
if self.box_mode == "extremes": if self.box_mode == "extremes":
return ( return (
'Min: %s\nQ1 : %s\nQ2 : %s\nQ3 : %s\nMax: %s' % 'Min: %s\nQ1 : %s\nQ2 : %s\nQ3 : %s\nMax: %s' % tuple(
tuple(map(self._y_format, serie.points[1:6]))) map(self._y_format, serie.points[1:6])))
elif self.box_mode in ["tukey", "stdev", "pstdev"]: elif self.box_mode in ["tukey", "stdev", "pstdev"]:
return ( return (
'Min: %s\nLower Whisker: %s\nQ1: %s\nQ2: %s\nQ3: %s\n' 'Min: %s\nLower Whisker: %s\nQ1: %s\nQ2: %s\nQ3: %s\n'

3
pygal/graph/graph.py

@ -905,7 +905,8 @@ class Graph(PublicApi):
self.nodes['plot'], 'path', self.nodes['plot'], 'path',
class_='bg-lines', class_='bg-lines',
d='M%s %s L%s %s' % ( d='M%s %s L%s %s' % (
_current_x, 0, _current_x, self.height-self.margin_box.y)) _current_x, 0, _current_x,
self.height - self.margin_box.y))
for line in range(y_lines): for line in range(y_lines):
_current_y += (self.height - self.margin_box.y) / squares[1] _current_y += (self.height - self.margin_box.y) / squares[1]

12
pygal/graph/solidgauge.py

@ -38,14 +38,18 @@ class SolidGauge(Graph):
if self.half_pie: if self.half_pie:
start_angle = 3 * pi / 2 start_angle = 3 * pi / 2
center = ( center = (
(current_square[1]*sq_dimensions[0]) - (sq_dimensions[0] / 2.), (current_square[1] * sq_dimensions[0]) - (
(current_square[0]*sq_dimensions[1]) - (sq_dimensions[1] / 4)) sq_dimensions[0] / 2.),
(current_square[0] * sq_dimensions[1]) - (
sq_dimensions[1] / 4))
end_angle = pi / 2 end_angle = pi / 2
else: else:
start_angle = 0 start_angle = 0
center = ( center = (
(current_square[1]*sq_dimensions[0]) - (sq_dimensions[0] / 2.), (current_square[1] * sq_dimensions[0]) - (
(current_square[0]*sq_dimensions[1]) - (sq_dimensions[1] / 2.)) sq_dimensions[0] / 2.),
(current_square[0] * sq_dimensions[1]) - (
sq_dimensions[1] / 2.))
end_angle = 2 * pi end_angle = 2 * pi
max_value = serie.metadata.get(0, {}).get('max_value', 100) max_value = serie.metadata.get(0, {}).get('max_value', 100)

4
pygal/test/test_config.py

@ -540,8 +540,8 @@ def test_formatters(Chart):
"""Test custom formatters""" """Test custom formatters"""
if Chart._dual or Chart == Box: if Chart._dual or Chart == Box:
return return
chart = Chart(formatter=lambda x, chart, serie: '%s%s$' % ( chart = Chart(
x, serie.title)) formatter=lambda x, chart, serie: '%s%s$' % (x, serie.title))
chart.add('_a', [1, 2, {'value': 3, 'formatter': lambda x: u('%s¥') % x}]) chart.add('_a', [1, 2, {'value': 3, 'formatter': lambda x: u('%s¥') % x}])
chart.add('_b', [4, 5, 6], formatter=lambda x: u('%s') % x) chart.add('_b', [4, 5, 6], formatter=lambda x: u('%s') % x)
chart.x_labels = [2, 4, 6] chart.x_labels = [2, 4, 6]

Loading…
Cancel
Save