I have a requirement to set the color of stack column chart in relation with previous stack. Consider this fiddle. http://jsfiddle.net/0n7g4a1e/
series: [{
name: 'John',
data: [5, 3, 4, 7, 2],
stack: 'Actual'
}, {
name: 'John',
data: [3, 4, 4, 2, 5],
stack: 'Budget'
}]
If Jane - Actual is light green, Jane - Budget should be dark green. This should be for all categories, Apple through bananas. similarly if John - Acutal is light blue, John - budget should be dark blue.
How can this be done? I dont want to specify each point color, i am fine with automatic color that gets selected, just that the bugdet series should have a shade darker than the actual.
Thanks.
In a chart, click to select the data series for which you want to change the colors. On the Format tab, in the Current Selection group, click Format Selection. tab, expand Fill, and then do one of the following: To vary the colors of data markers in a single-series chart, select the Vary colors by point check box.
To change the background color of the chart you have to set in the chart. backgroundColor property. Bar colors in the series color property. Check the example with your chart I posted below.
The plotOptions is a wrapper object for config objects for each series type. The config objects for each series can also be overridden for each series item as given in the series array. Configuration options for the series are given in three levels. Options for all series in a chart are given in the plotOptions.
Stacked charts are often used to visualize data that accumulates to a sum. This chart is showing data labels for each individual section of the stack.
You need to set colors for Highcharts in that way, for example, basing on default colors:
var colors = Highcharts.getOptions().colors.slice(0), // get default colors
dark = -0.5;
colors[1] = Highcharts.Color(colors[0]).brighten(dark).get(); // using Highcharts.Color(), get darker golor, using first color as base
colors[3] = Highcharts.Color(colors[2]).brighten(dark).get();
Now just set this colors:
$('#container').highcharts({
chart: {
type: 'column'
},
colors: colors,
Demo: http://jsfiddle.net/0n7g4a1e/2/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With