Skip to content

Commit

Permalink
Added consistency in inner_radius for pie charts serie graph
Browse files Browse the repository at this point in the history
  • Loading branch information
yobuntu committed Jan 7, 2020
1 parent 5e25c98 commit bb0b183
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pygal/graph/pie.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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(
Expand All @@ -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
Expand Down

0 comments on commit bb0b183

Please sign in to comment.