[Python] using python pptx how can i display the % in my chart data

Discussão em 'Python' iniciado por Stack, Junho 26, 2025.

  1. Stack

    Stack Membro Participativo

    I would like to create a chart on a powerpoint slide with pourcent datas , python doesn't let my directly put the % symbol on my data so i had to only put the datas , but i want to show the % symbol on the chart and also on the axes So heres my code :

    if slide:

    for shape in slide.shapes:

    if shape.shape_type == MSO_SHAPE_TYPE.CHART:
    chart = shape.chart
    if result and moisDate and nameIntake :
    chart_data = CategoryChartData()
    chart_data.categories = nameIntake
    for moisSingleDate in moisDate:
    chart_data.add_series( str(moisSingleDate) , values= ( result[moisSingleDate]) ,number_format= '0%')
    chart.replace_data(chart_data)
    print(result)


    but unfortunatly my datas gets multiplied by 100... instead of displaying 24.93% i get 2493% does anyone knows how to do it please ?

    Continue reading...

Compartilhe esta Página