From 8793b71004fb37b051d3edcabef77892f5ad02db Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 7 Dec 2014 21:15:29 +1000 Subject: [PATCH 1/2] Add ability to edit single margins --- pygal/config.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pygal/config.py b/pygal/config.py index 2de0aa4..0f7c09b 100644 --- a/pygal/config.py +++ b/pygal/config.py @@ -242,6 +242,22 @@ class Config(CommonConfig): 20, int, "Look", "Margin around chart") + margin_top = Key( + 20, int, "Look", + "Margin around top of chart") + + margin_right = Key( + 20, int, "Look", + "Margin around right of chart") + + margin_bottom = Key( + 20, int, "Look", + "Margin around bottom of chart") + + margin_left = Key( + 20, int, "Look", + "Margin around left of chart") + tooltip_border_radius = Key(0, int, "Look", "Tooltip border radius") inner_radius = Key( From 035f36011cd87d9383c1cf0d710edad14ea269a2 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 7 Dec 2014 21:17:00 +1000 Subject: [PATCH 2/2] Add ability to edit single margins --- pygal/graph/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pygal/graph/base.py b/pygal/graph/base.py index ff5ac22..d9d3e95 100644 --- a/pygal/graph/base.py +++ b/pygal/graph/base.py @@ -50,7 +50,10 @@ class BaseGraph(object): self._x_2nd_labels = None self._y_2nd_labels = None self.nodes = {} - self.margin = Margin(*([self.margin] * 4)) + self.margin = Margin(self.margin_top or self.margin, + self.margin_right or self.margin, + self.margin_bottom or self.margin, + self.margin_left or self.margin) self._box = Box() self.view = None if self.logarithmic and self.zero == 0: