python-pptx icon indicating copy to clipboard operation
python-pptx copied to clipboard

Set data labels away from chart from fixed position

Open SaiRahul-Draup opened this issue 1 year ago • 0 comments

I am using a doughnut chart in python-pptx; I want to set the datalabels to br away from the chart (exactly 2 inches) as datalabel position is not sufficient, I am lloking for other alternatives:

for idx, point in enumerate(chart.series[0].points): dl = point.data_label dl.text_frame.text = f"{chart_data.categories[idx].label}" dl.show_leader_line = true for para in dl.text_frame.paragraphs: for rune in para.runs: rune.font.size = Pt(int(shape_filled_text_ls[1]) #set this datalabel 2 inches away from chart center so that leader lines are visible

SaiRahul-Draup avatar Oct 26 '24 20:10 SaiRahul-Draup