How Can I Have Color Axis In Bubble Chart Using Highchart?
I need to develop color axis using bubble highchart with [x, y, z] values , for reference https://developers.google.com/chart/interactive/docs/gallery/bubblechart#color-by-numbers
Solution 1:
Based on the answer from this topic - stepped-color-shading-in-highcharts-doughnut-chart.
Wrapping bubble's prototype:
var bubbleProto = Highcharts.seriesTypes.bubble.prototype;
bubbleProto.axisTypes = ['xAxis', 'yAxis', 'colorAxis'];
bubbleProto.optionalAxis = 'colorAxis';
bubbleProto.colorKey = 'y';
Highcharts.wrap(bubbleProto, 'translate', function(proceed) {
proceed.apply(this, Array.prototype.slice.call(arguments, 1));
Highcharts.seriesTypes.heatmap.prototype.translateColors.call(this);
});
Live example and output
http://jsfiddle.net/4y3qgdmn/41/
Solution 2:
Since Highcharts v7.2.0 you can add coloraxis
module and use it for almost all series types:
Highcharts.chart('container', {
...,
colorAxis: {
minColor: '#c6e48b',
maxColor: '#196127'
}
});
Live demo:http://jsfiddle.net/BlackLabel/swL0ngvm/
API Reference:https://api.highcharts.com/highcharts/colorAxis
Post a Comment for "How Can I Have Color Axis In Bubble Chart Using Highchart?"