Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
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

Labels (1)
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