first thanks for this great community!
I didn't find anything in the Highcharts Docs and also nothing on stackoverflow or Google.
I would like to provide fill-color informations for each point in the OHLC-Chart by passing it through JSON. Is this possible?
Here is my JSON (for example)
[[973033200000,10.18,10.18,10.74,10.18],
[973119600000,10.16,10.16,10.72,10.16],
[973465200000,10.1,10.1,10.66,10.1],
[973551600000,10.16,10.16,10.72,10.16],
[973638000000,10.17,10.17,10.73,10.17],
[973724400000,10.2,10.2,10.77,10.2]]
An alternative for my purposes would be to change the point-colors for a date-range with jQuery.
May this is possible?
Thank you for answering!
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/