I'm trying to use python-pptx to extract XY scatter data for special cases where the reference excel sheet is not present and my existing VBA code fails to read the data. I can get all the y_values but I haven't been able to figure out how to get the x_values
. From the documentation, I understand XY Scatter doesn't have "categories" like the other plots. However, I don't see any method or object in the chart or chart.plots[0]
that will give me access to the x_values
. I only see "categories"
and of course, it is empty for XY Scatter.
def get_chart_data():
for sld in prs.slides:
for shape in sld.shapes:
if shape.has_chart:
chart = shape.chart
series_data=[]
for series in chart.series:
y_val = []
for value in series.values:
y_val.append(value)