Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Bar Chart Colors

Hello QV Experts,

Below code I am using for drawing  combo charts. How do I change default Chart bar colors by writing code?

  Manually I configure this way =>  Chart properties -> Colors -> Data Appearance -> Colors 1-6. But how do I automate this?

Any help highly appreciated.

    

set chart = ActiveDocument.Sheets(0).CreateComboChart
set p = chart.GetProperties
 
p.GraphLayout.WindowTitle.v = chartName
p.GraphLayout.Frame.TextAdjustHorizontal = 1

chart.SetProperties p

Thanks

1 Solution

Accepted Solutions
Not applicable
Author

Hello QV

I found a way to achive this below is the code, this might help other. hence sharing

set colors = p.ChartProperties.ColorMap

colors(0).PrimaryCol.Col = RGB(0,73,147)  

colors(1).PrimaryCol.Col = RGB(178,36,36)

chart.SetProperties p

View solution in original post

1 Reply
Not applicable
Author

Hello QV

I found a way to achive this below is the code, this might help other. hence sharing

set colors = p.ChartProperties.ColorMap

colors(0).PrimaryCol.Col = RGB(0,73,147)  

colors(1).PrimaryCol.Col = RGB(178,36,36)

chart.SetProperties p