带有差异色的高位图中的金字塔图

时间:2019-03-05 14:57:54

标签: highcharts

您应该像下面一样更改组件

导入Highcharts和渠道

import * as Highcharts from 'highcharts';

require('highcharts/modules/funnel')(Highcharts);

声明

var require: any;   
    chart: any;

将其添加到ngOnInit

Highcharts.chart('jaibalaya', {
  chart: {
    type: 'pyramid'
  },
  title: {
    text: '',
    x: -50
  },
  plotOptions: {
    series: {
      dataLabels: {
        enabled: true,
        format: '<b>{point.name}</b> ({point.y:,.0f})',
        color: 'black'
      }
    }
  },

  legend: {
    enabled: true
  },
  credits: {
    enabled: false
  },
  series: [{
    data: [
      ['Inactive', 15],
      ['Small', 20],
      ['Medium', 25],
      ['Big', 20],
      ['Top', 10]
    ]
  }]
});

HTML中的更改

<div id="jaibalaya" style="min-width: 410px; max-width: 600px; height: 400px; margin: 0 auto">
</div>

1 个答案:

答案 0 :(得分:0)

要更改pyramid图表中的颜色,可以使用colors数组:

Highcharts.chart('jaibalaya', {
    chart: {
        type: 'pyramid'
    },
    colors: ['red', 'yellow', 'blue', 'green', 'orange'],
    ...
});

实时演示:http://jsfiddle.net/BlackLabel/0vqr35jn/

API参考:https://api.highcharts.com/highcharts/colors