Extjs Changing color of bars in stacked bar chart

Nazin picture Nazin · Jun 15, 2011 · Viewed 16.4k times · Source

let's take this example... how to change colors of those bars?

I know I can change it via renderer but it won't change legend.

I have tried to use:

style: {fill: 'red'}

but it changes color of ever bar

I have tried to put colors in array, its not working.

I have tried to put each style in array, like this:

style: [{fill: 'red'}, {fill: 'green'}, {fill: 'blue'}]

But it won't work either, since I can put titles in array like:

title: ['title1', 'title2', 'title3']

I thought it (styles) should work too but not.

So how can I change color of each "data" bar?

Answer

NT3RP picture NT3RP · Jun 15, 2011

Bar colors are actually determined by the chart's theme:

Ext.create('Ext.chart.Chart', {
    theme: 'myTheme'
    //the remainder of your code...
});

In order to use custom colors, you will need to extend the existing 'Base' theme, as in the custom area chart example.