Torben
Torben

Reputation: 1290

Change color of pie chart on drilldown

I've a pie chart with drilldown data and like to change the chart.options.colors. Is there a way to replace the whole color array in chart.options.colors on drilldown, and restore the old color array to chart.options.colors on drillup?

Tried to change the array in chart.options.colors and to call redraw(), but it does not work correctly.

Thank you

Torben

Upvotes: 1

Views: 3704

Answers (2)

ronitkadam
ronitkadam

Reputation: 21

You can replace every element of the series array

{
 name: 'sampleName',
 id: 'sampleId',
 data: [
    ['subElement1', value1],
    ['subElement2', value2]
] 
}

with

{
name: 'sampleName',
id: 'sampleId',
data: [{
        name: 'subElement1',
        y: value1,
        color: '#123456'
    },
    {
        name: 'subElement2',
        y: value2,
        color: '#123456'
    }
]}

Upvotes: 2

Strikers
Strikers

Reputation: 4776

You can do this in a quite old fashioned way by giving the color to every point you wish to have.

in data section:

data: [24,28,{
        y: 40,
        color: 'red'
    }, 10, 30, 40
]

here I've worked out a example : http://jsfiddle.net/tbjuq/

I hope this will help you to achieve what you are looking for.

Upvotes: 4

Related Questions