Highcharts饼图

var stock = Highcharts.chart('stock', option_13);


// 股东信息分布环形图
        var option_13 = {
            chart: {
                //图表的大小在这里改  
                type: 'pie',
                width: 780,
                height: 380,
                backgroundColor: '#fff'
            },
            title: {
                text: ''
            },
            legend: {
                enabled: true,// 打开或关闭图例。
                align: 'left', //水平方向位置
                verticalAlign: 'bottom',//垂直方向位置,
                labelFormatter: function () {//格式化标签,在饼图图例内显示百分比
                    return this.name + '(' + this.percentage + '%)';
                }
            },
            plotOptions:
            {
                pie: {
                    allowPointSelect: false,//点击饼图不位移
                    cursor: 'pointer',
                    dataLabels: {
                        enabled: false,
                        color: '#444',
                        style: {
                            fontWeight: 'normal',
                            fontSize: '20px',
                            "textShadow": 'none'
                        },
                        formatter: function () {
                            //this 为当前的点(扇区)对象,可以通过  console.log(this) 来查看详细信息
                            return this.point.name + ' ' + this.point.y + '%';
                        }
                    },
                    innerSize: '0',//饼状图的内径大小
                    point: {
                        events: {
                            legendItemClick: function (e) {
                                return false; // 直接 return false 即可禁用图例点击事件
                            }
                        }
                    }
                }
            },
            tooltip: {
                valueSuffix: '%',
            },
            series: [{
                //这是鼠标悬停时的颜色  
                name: '占比',
                //自定义颜色  
                //data:tenderMethod
                showInLegend: true,
                data: [{
                    name: '股1',
                    color: "#1a8194",
                    y: 51
                }, {
                    name: '股2',
                    color: "#f3b23a",
                    y: 40.03
                }, {
                    name: '股3',
                    color: "#e8445c",
                    y: 4.8
                }, {
                    name: '股4',
                    color: "#14ac95",
                    y: 4.17
                }]
            }]

};

猜你喜欢

转载自blog.csdn.net/github_39051926/article/details/79911279