Browse Source

Fix shift

pull/8/head
Florian Mounier 13 years ago
parent
commit
dd73b3bf4f
  1. 2
      pygal/line.py
  2. 2
      pygal/view.py

2
pygal/line.py

@ -47,7 +47,7 @@ class Line(BaseGraph):
self.validate() self.validate()
x_step = len(self.series[0].values) x_step = len(self.series[0].values)
x_pos = [x / float(x_step - 1) for x in range(x_step) x_pos = [x / float(x_step - 1) for x in range(x_step)
] if x_step != 1 else [0] # Center if only one value ] if x_step != 1 else [.5] # Center if only one value
vals = [val for serie in self.series for val in serie.values] vals = [val for serie in self.series for val in serie.values]
margin = Margin(*(4 * [10])) margin = Margin(*(4 * [10]))
ymin, ymax = min(vals), max(vals) ymin, ymax = min(vals), max(vals)

2
pygal/view.py

@ -14,8 +14,6 @@ class View(object):
self.height = height self.height = height
xrng = (xmax - xmin) or 1 xrng = (xmax - xmin) or 1
yrng = (ymax - ymin) or 1 yrng = (ymax - ymin) or 1
if xrng == 1:
xmin -= .5
if yrng == 1: if yrng == 1:
ymin -= .5 ymin -= .5
self.box = Box(xmin, ymin, xrng, yrng) self.box = Box(xmin, ymin, xrng, yrng)

Loading…
Cancel
Save