0

我有一个带有两个切片的简单 DONUT 图表。默认颜色是红色和蓝色。我想将颜色更改为较浅的红色和绿色。

这是将两个切片都设置为绿色

#Doughnut
doughnutchart_data = ChartData()
doughnutchart_data.categories = ['incomplete','completed']
doughnutchart_data.add_series('YTD COMPLETION TO PLAN', (49.5,50.5))


# add chart to slide
x, y, cx, cy = Inches(6.6), Inches(0.8), Inches(4), Inches(3)
ThisDoughnutChart = ThisSlide.shapes.add_chart(
    XL_CHART_TYPE.DOUGHNUT, x, y, cx, cy, doughnutchart_data
).chart

ThisDoughnutChart.has_legend = False

ThisDoughnutChart.series[0].format.fill.solid()
ThisDoughnutChart.series[0].format.fill.fore_color.rgb = RGBColor(13,230,2) # Green
4

1 回答 1

1

尝试:

point = chart.series[0].points[0]
fill = point.format.fill
fill.solid()
fill.fore_color.rgb = RGBColor(13, 230, 2)
于 2017-08-08T22:19:27.063 回答