score:2

You can pass information of color per point like this http://jsfiddle.net/gvkv4f50/1/

$(function () {
    // create the chart
    $('#container').highcharts('StockChart', {
        plotOptions: {
            ohlc: {
                colorByPoint: true,
            }
        },

        rangeSelector: {
            inputEnabled: $('#container').width() > 480,
            selected: 2
        },

        title: {
            text: 'AAPL Stock Price'
        },

        series: [{
            type: 'ohlc',
            name: 'AAPL Stock Price',
            data: [{
                open: 8.34,
                high: 8.56,
                low: 5.47,
                close: 6.15,
                color: 'yellow'
            }, {
                open: 8.34,
                high: 8.56,
                low: 5.47,
                close: 6.15,
                color: 'green'
            }],
            dataGrouping: {
                units: [
                    [
                        'week', // unit name
                    [1] // allowed multiples
                    ],
                    [
                        'month', [1, 2, 3, 4, 6]]
                ]
            }
        }]
    });
});

If you want to ignore different coloring when open point has lower value than close point add this:

 Highcharts.wrap(Highcharts.seriesTypes.ohlc.prototype, 'getAttribs', function (p, args) {
    Highcharts.seriesTypes.column.prototype.getAttribs.apply(this, args);
});

You can see how in here - http://jsfiddle.net/chybv1mt/3/


Related Articles