Browse Source

Don't crash when there are no x or y labels

pull/8/head
Guillaume Ayoub 13 years ago
parent
commit
fe34872f2e
  1. 8
      pygal/svg.py

8
pygal/svg.py

@ -78,14 +78,15 @@ class Svg(object):
height=self.view.height)
def x_axis(self, labels):
if not labels:
return
axis = self.node(self.plot, class_="axis x")
if 0 not in [label[1] for label in labels]:
self.node(axis, 'path',
d='M%f %f v%f' % (0, 0, self.view.height),
class_='line')
if not labels:
return
for label, position in labels:
guides = self.node(axis, class_='guides')
x = self.view.x(position)
@ -98,6 +99,9 @@ class Svg(object):
text.text = label
def y_axis(self, labels):
if not labels:
return
axis = self.node(self.plot, class_="axis y")
if 0 not in [label[1] for label in labels]:

Loading…
Cancel
Save