1
votes

Below is my code to display basic column chart.

$(function () {
 Highcharts.setOptions({
colors: ['#f89422','#8cc641']

});

    $('#container').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: 'Monthly Average Rainfall'
        },
        subtitle: {
            text: 'Source: WorldClimate.com'
        },
        xAxis: {
            categories: [
                'Jan',
                'Feb'
                               ]
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Rainfall (mm)'
            }
        },
        tooltip: {
            headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
            pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
            footerFormat: '</table>',
            shared: true,
            useHTML: true
        },
        plotOptions: {
            colorbypoint: true,
            column: {
                pointPadding: 0.2,
                borderWidth: 0
            }
        },
        series: [{
            name: 'Tokyo',
            data: [49.9, 71.5]

        }]
    });
});

Though I have given 2 colors in the set options, and colorBypoint: true in plotOptions, It is showing the same color. Orange.

Any idea? Please refer this fiddle - http://jsfiddle.net/88YSd/

1

1 Answers

0
votes

The points are showing the same color as they are in the same series.

You can specify indivual point colors like this:

 data: [{y:49.9,color:'#f89422'}, {y:71.5,color:'#8cc641'}]

http://jsfiddle.net/Zhmw2/

An alternative would be to put the two points in separate series

 series: [{
            name: 'Jan',
            data: [49.9]

        },{
            name: 'Feb',
            data: [71.5]

        }

http://jsfiddle.net/H5KmK/