Kagebi
Kagebi

Reputation: 23

Change color in specific columns w/ multiple series

I have two series each with its color and I want to be able to define a different color for both series in a specific column.

How can I display the first 3 columns in grey? https://jsfiddle.net/Kagebi/omcqrzsu/

Highcharts.chart('container', {
    chart: {
        type: 'column',
    },
    plotOptions: {
        column: {           
          grouping: false
        }
    },
    tooltip: {
        shared: true // true breaks series highliting on hover
    },

    xAxis: {
        categories: ['24-02', '25-02', '26-02', '27-02', '28-02', '29-02', '01-03', '02-03', '03-03', '04-03', '05-03']
    },
    series: [
        {
      name: 'Expected',
      data: [180, 140, 180, 140, 180, 140, 180, 140, 180, 140, 180],
      color: '#b2dbff',
      },

        {
      name: 'Current',
      data: [99, 197, 165, 80, 144, 80, 144, 80, 144, 80, 144],
      color: '#1d94fa'}
      ],
   events:{
        load: function() {
            var point = this.series[0].points[1];

            point.update({
                color: 'black'
            });
        }
},

    }
)

Upvotes: 2

Views: 24

Answers (1)

Clafouti
Clafouti

Reputation: 4595

You can specify the color of each entry in a serie like that:

    data: [{
      name: 'Point 1',
      color: '#00FF00',
      y: 0
    }, {
      name: 'Point 2',
      color: '#FF00FF',
      y: 5
    }]

See the documentation here : https://www.highcharts.com/docs/chart-concepts/series (point n°3).

I've updated your jsfiddle here with the first three columns in grey: https://jsfiddle.net/0mhnck5L/

Upvotes: 1

Related Questions