From bb0b1835b8c656cdde6e38f39bb839bc9b1ecc3e Mon Sep 17 00:00:00 2001 From: Yohann Rebattu Date: Tue, 7 Jan 2020 15:57:21 +0100 Subject: [PATCH] Added consistency in inner_radius for pie charts serie graph --- pygal/graph/pie.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pygal/graph/pie.py b/pygal/graph/pie.py index d6fcf3cb..047d302d 100644 --- a/pygal/graph/pie.py +++ b/pygal/graph/pie.py @@ -51,6 +51,13 @@ def slice(self, serie, start_angle, total): (self.height - self.margin_box.y) / 2.) radius = min(center) + hole_radius = radius * serie.inner_radius if serie.inner_radius else 0 + if dual: + small_radius = radius * .9 + big_radius = radius + else: + big_radius = radius * .9 + small_radius = hole_radius for i, val in enumerate(serie.values): perc = val / total if self.half_pie: @@ -63,12 +70,6 @@ def slice(self, serie, start_angle, total): slice_ = decorate( self.svg, self.svg.node(slices, class_="slice"), metadata ) - if dual: - small_radius = radius * .9 - big_radius = radius - else: - big_radius = radius * .9 - small_radius = radius * serie.inner_radius alter( self.svg.slice( @@ -82,7 +83,7 @@ def slice(self, serie, start_angle, total): val = self._serie_format(serie, sum(serie.values)) self.svg.slice( serie_node, self.svg.node(slices, - class_="big_slice"), radius * .9, 0, + class_="big_slice"), small_radius, hole_radius, serie_angle, original_start_angle, center, val, i, metadata ) return serie_angle