From da0cb8a5f62189983f33400a34ab1c4d7dbc5b8e Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Fri, 27 Apr 2012 14:30:10 +0200 Subject: [PATCH] Fix /0 --- pygal/config.py | 2 ++ pygal/graph/graph.py | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/pygal/config.py b/pygal/config.py index b2ff60f..5c43c85 100644 --- a/pygal/config.py +++ b/pygal/config.py @@ -59,6 +59,8 @@ class Config(object): y_label_rotation = 0 #: Set to false to remove legend show_legend = True + #: Set to true to position legend at bottom + legend_at_bottom = True #: Set to false to remove dots show_dots = True #: Size of legend boxes diff --git a/pygal/graph/graph.py b/pygal/graph/graph.py index 859fb20..4937fd0 100644 --- a/pygal/graph/graph.py +++ b/pygal/graph/graph.py @@ -106,7 +106,7 @@ class Graph(BaseGraph): axis = self.svg.node(self.nodes['plot'], class_="axis x") truncation = self.truncate_label if not truncation: - if self.x_label_rotation: + if self.x_label_rotation or len(self._x_labels) <= 1: truncation = 25 else: first_label_position = self.view.x(self._x_labels[0][1]) @@ -214,10 +214,10 @@ class Graph(BaseGraph): """Make the title""" if self.title: self.svg.node(self.nodes['graph'], 'text', class_='title', - x=self.margin.left + self.view.width / 2, - y=self.title_font_size + 10 - ).text = truncate(self.title, int(reverse_text_len( - self.width, self.title_font_size))) + x=self.margin.left + self.view.width / 2, + y=self.title_font_size + 10 + ).text = truncate(self.title, int(reverse_text_len( + self.width, self.title_font_size))) def _serie(self, serie): """Make serie node"""