scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.44k stars 528 forks source link

feature: DataLabels to show percentage (%) symbol for data points properties #728

Closed soumyand closed 3 years ago

soumyand commented 3 years ago

while generating column stacked 100% chart. if suppose series values are (1, 8, 1). I would expect to see segments with data labels 10%, 80% and 10%.

However, with the code below I see 100%, 800% and 100%.

below is code used. plot = chart.plots[0] plot.has_data_labels = True

    data_labels = chart.plots[0].data_labels
    data_labels.font.size = Pt(6)
    data_labels.number_format = '0%'
    data_labels.position = XL_LABEL_POSITION.CENTER

when data_labels.show_percentage=True is set instead of data_labels.number_format = '0%' it just shows number but not percentage symbol.

image

I want to show data labels with percentage like below image

https://stackoverflow.com/questions/68711807/feature-datalabels-to-show-percentage-symbol-for-data-points-properties-72

scanny commented 3 years ago

Please do not duplicate StackOverflow questions here. Support questions should be posted on SO, reserving this issues list for suspected bugs and feature requests.