diff --git a/demo/moulinrouge/tests.py b/demo/moulinrouge/tests.py index b56fbc0..408c399 100644 --- a/demo/moulinrouge/tests.py +++ b/demo/moulinrouge/tests.py @@ -107,6 +107,7 @@ def get_test_routes(app): graph.add('3', [7, -14, -10, None, 8, 3, 1]) graph.add('4', [7, 4, -10, None, 8, 3, 1]) graph.x_labels = ('a', 'b', 'c', 'd', 'e', 'f', 'g') + graph.x_label_rotation = 90 return graph.render_response() @app.route('/test/one/') @@ -133,7 +134,7 @@ def get_test_routes(app): graph.add('1', [.1, 10, .001, 1000000]) graph.add('2', [.234, 243, 2, 2981379, 1231]) graph.x_labels = ('a', 'b', 'c', 'd', 'e') - graph.x_label_rotation = 45 + graph.x_label_rotation = 90 return graph.render_response() @app.route('/test/zero_at_34/') diff --git a/pygal/graph/graph.py b/pygal/graph/graph.py index 66101b3..397a4dd 100644 --- a/pygal/graph/graph.py +++ b/pygal/graph/graph.py @@ -130,6 +130,7 @@ class Graph(BaseGraph): d='M%f %f v%f' % (0, 0, self.view.height), class_='line') for label, position in self._x_labels: + major = is_major(position) guides = self.svg.node(axis, class_='guides') x = self.view.x(position) y = self.view.height + 5 @@ -137,12 +138,15 @@ class Graph(BaseGraph): self.svg.node( guides, 'path', d='M%f %f v%f' % (x, 0, self.view.height), - class_='%sline' % ( + class_='%s%sline' % ( + 'major ' if major else '', 'guide ' if position != 0 else '')) + y += .5 * self.label_font_size + 5 text = self.svg.node( guides, 'text', x=x, - y=y + .5 * self.label_font_size + 5 + y=y, + class_='major' if major else '' ) text.text = truncate(label, truncation) if text.text != label: