Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you change the colour of each category within a highcharts column chart?

Tags:

highcharts

I have have a column chart which has a number of categories, each with a single data point (e.g. like this one). Is it possible to change the colour of the bar for each category? i.e. so each bar would have its own unique colour rather than all being blue?

like image 937
James Hollingworth Avatar asked Sep 14 '11 09:09

James Hollingworth


People also ask

Is it possible to have a separate color for each category in a bar graph?

You can also set the color individually for each point/bar if you change the data array to be configuration objects instead of numbers.

How do I change the color of a column in Splunk chart?

Adding colour to your charts in Splunk dashboards is done using Simple XML. Go to the 'Edit' mode of the relevant dashboard and select the 'Source' option. There are two main ways to add colours to your dashboards.

How do you change chart colors based on value?

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.


2 Answers

Also you can set option:

  {plotOptions: {column: {colorByPoint: true}}} 

for more information read docs

like image 29
antonversal Avatar answered Sep 20 '22 04:09

antonversal


You can also set the color individually for each point/bar if you change the data array to be configuration objects instead of numbers.

data: [       {y: 34.4, color: 'red'},     // this point is red       21.8,                        // default blue       {y: 20.1, color: '#aaff99'}, // this will be greenish       20]                          // default blue 

Example on jsfiddle

enter image description here

like image 170
eolsson Avatar answered Sep 18 '22 04:09

eolsson