Highcharts 柱形图,线条图,饼图组合

返回上一级

下图是一个 Highcharts 3D 柱形图,线条图,饼图组合

配置

配置属性 series.type 为 column

var series = {
   type: 'column'
};

范例

下面的代码列出了 Highcharts 3D 柱形图,线条图,饼图组合 的基本配置

<!doctype html>
<meta charset="utf-8" />
<title>Highcharts 基础教程 | 简单教程(www.twle.cn)</title>
<script src="https://cdn.hcharts.cn/highcharts/highcharts.js"></script>
<div id="container" style="width: 500px; height: 400px; margin: 0 auto"></div>
<script>

var title = {
  text: 'Combination chart'   
};
var xAxis = {
  categories: ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
};
var labels = {
  items: [{
     html: '水果消费',
        style: {
           left: '50px',
           top: '18px',
           color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
        }
  }]
};
var series= [{
    type: 'column',
        name: 'Jane',
        data: [3, 2, 1, 3, 4]
    }, {
        type: 'column',
        name: 'John',
        data: [2, 3, 5, 7, 6]
    }, {
        type: 'column',
        name: 'Joe',
        data: [4, 3, 3, 9, 0]
    }, {
        type: 'spline',
        name: 'Average',
        data: [3, 2.67, 3, 6.33, 3.33],
        marker: {
            lineWidth: 2,
            lineColor: Highcharts.getOptions().colors[3],
            fillColor: 'white'
        }
    }, {
        type: 'pie',
        name: '总消费',
        data: [{
            name: 'Jane',
            y: 13,
            color: Highcharts.getOptions().colors[0] // Jane 的颜色
        }, {
            name: 'John',
            y: 23,
            color: Highcharts.getOptions().colors[1] // John 的颜色
        }, {
            name: 'Joe',
            y: 19,
            color: Highcharts.getOptions().colors[2] // Joe 的颜色
        }],
        center: [100, 80],
        size: 100,
        showInLegend: false,
        dataLabels: {
            enabled: false
        }
  }
];     

var options = {};

options.title = title;
options.series = series;
options.labels = labels;
options.xAxis = xAxis;

Highcharts.chart('container',options);
</script>

运行范例 »

以上范例输出如下

返回上一级

学习 Hightcharts

关于   |   FAQ   |   我们的愿景   |   广告投放   |  博客

  简单教程,简单编程 - IT 入门首选站

Copyright © 2013-2022 简单教程 twle.cn All Rights Reserved.