How can i have color axis in bubble chart using Hi

2019-09-22 11:19发布

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

I need to develop above mentioned bubble chart which is developed in google chart to High chart [bubble] .

2条回答
疯言疯语
2楼-- · 2019-09-22 11:57

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/

bubble series with color axis

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-09-22 12:06

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

Blog: https://www.highcharts.com/blog/news/color-coded-data/

查看更多
登录 后发表回答