Pie chart slice label centering and word wrapping
- Dominant language
- Python
- Stars
- 2.8k
- Forks
- 419
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
First of all thanks for making this library available. Love that there are no dependencies!
I'm running into an issue with the position and word wrapping of labels in pie chart slices. Here's the code:
```py
import pygal
chart = pygal.Pie(
print_labels=True,
show_legend=False
)
chart.add('First', [{'value': 2, 'label': 'This is the first'}])
chart.add('Second', [{'value': 2, 'label': 'This is the second'}])
chart.add('Third', [{'value': 2, 'label': 'This is the third'}])
chart.render_to_file('test.svg')
```
As you can see from the result below, the labels are originating from the center of the slices. I need to position them so that they are centered w.r.t the middle point of each slice. Also, if the text is too long e.g. in the third slice, I need the text to wrap to the next line below.
If not possible out of the box, are there any workarounds to achieve either of those?
Thanks in advance!

Contributor guide
Research direction
Start by reproducing the issue with the Python snippet and its generated SVG, then trace pygal's pie-chart label rendering. Done means slice labels are centered relative to each slice's midpoint and long labels wrap onto subsequent lines.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100