Skip to content

Bar Chart Colors #901

@FreddyD112

Description

@FreddyD112

Hello there,

I have a quick question if anyone can help me.

Basically, I'm creating a bar graph and have a series that covers TEST1, TEST2 & TEST3.

I don't want the default color of the individual bar graphs and want to change the colors myself to the traffic light system e.g red, amber green.

I've managed to figure out how to change the color of the bar chart, but since I can only change the series and plot all the bars change to the single color I've identified below.

chart_data = CategoryChartData()  
chart_data.chart_style = [1]
chart_data.categories = ['Test1', 'Test2', 'Test2']
chart_data.add_series('Total', (1, 4, 7))



top = Inches(3)
left = Inches(1)
width = Inches(5.45) # from top of slides X inches inward
height =  Inches(3.89)


Graph = Slide_IRstat.shapes.add_chart(XL_CHART_TYPE.COLUMN_CLUSTERED, top, left, width, height, chart_data)

chart = Graph.chart
plot = chart.plots[0]
series = plot.series[0]
fill = series.format.fill
fill.solid()
fill.fore_color.rgb = RGBColor(255, 230, 210)

Has anyone got advise of how i can change the bars colors individually? Say for example

1 = red

4 = Amber

7 = Green.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions