Reputation: 83
How to access line format object for series in chart based on XL_CHART_TYPE.LINE?
chart_data = ChartData()
vec2 = [ float(i.value) for i in xl_sheet.col(1)]
chart_data.categories = [ datetime.datetime.fromordinal(int(693594+i.value )) for i in xl_sheet.col(0)]
uu=chart_data.add_series('Model1', tuple(vec2))
I didn't access to format of series line by
uu.format.line.color.rgb = RGBColor((100,100,100))
Upvotes: 1
Views: 1279
Reputation: 28863
After the chart is created, you access each line by the series that line represents:
graphic_frame = slide.shapes.add_chart(..chart_data,..)
# ---graphic frame is the shape containing the chart, not the chart itself---
chart = graphic_frame.chart
# ---get the desired series from the chart---
series = chart.series[0]
# ---series.format is a ChartFormat object, which in turn provides access to
# the LineFormat object for that series---
line = series.format.line
# ---change the line style, color, etc. the same way as for any other line---
line.color.rgb = RGBColor(255, 0, 0)
Upvotes: 2