小编Agi*_* la的帖子

在Highcharts中分组传说

我有两个堆积的条形图,但所有图例(两个条形图)都一起显示.我想根据条形图中堆积的项目对图例进行分组.有人能帮我吗?

$(function () {
        $('#container').highcharts({

            chart: {
                type: 'bar'
            },

            title: {
                text: 'Total fruit consumtion, grouped by gender'
            },

            xAxis: {
                categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
            },

            yAxis: {
                allowDecimals: false,
                min: 0,
                title: {
                    text: 'Number of fruits'
                }
            },

            tooltip: {
                formatter: function() {
                    return '<b>'+ this.x +'</b><br/>'+
                        this.series.name +': '+ this.y +'<br/>'+
                        'Total: '+ this.point.stackTotal;
                }
            },

            plotOptions: {
                bar: {
                    stacking: 'normal'
                }
            },

            series: [{
                name: 'John',
                data: [5, 3, 4, 7, 2], …
Run Code Online (Sandbox Code Playgroud)

javascript highcharts

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

highcharts ×1

javascript ×1