显示分组堆叠柱形图的图例 - highhcarts

我正在使用 highcharts 来呈现柱形图。由于它是分组堆叠柱形图,目前我得到的图例名称重复,正如您在小提琴中看到的那样:

http://img4.mukewang.com/64b109e60001771f06380097.jpg

http://jsfiddle.net/z7aLr6cu/

我试图只呈现传说中唯一的名字;就我而言:

john fem

我基本上是想一起支持所有的传奇(约翰=>蓝柱系列+绿色+紫色)

代码:

$(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: "Confirmed",

                                stack: "ACTIVE",

                data: [4740, 1378, 8]

            }, {

                data: [2932, 141],

                name: "Potential",

                stack: "ACTIVE"

            }, {

                data: [1752, 11],

                name: "Confirmed",

                stack: "REOPENED"

            },{

            data: [1089, 2],

            name: "Potential",

            stack: "REOPENED"

            },{

            data: [2332, 1960, 42],

              name: "Potential",

              stack: "NEW"

            },{

            data:[480, 4684, 2258],

            name: "Confirmed",

            stack: "NEW"

            }]

        });

    });

这可能吗


POPMUISE
浏览 77回答 1
1回答

慕桂英4014372

使用linkedTo属性:series: [{&nbsp; ...,&nbsp; id: 'john'}, {&nbsp; ...,&nbsp; id: 'fem'}, {&nbsp; ...,&nbsp; linkedTo: 'john'}, {&nbsp; ...,&nbsp; linkedTo: 'fem'}, {&nbsp; ...,&nbsp; linkedTo: 'john'}, {&nbsp; ...,&nbsp; linkedTo: 'fem'}]现场演示: http: //jsfiddle.net/BlackLabel/a4sog5xb/API 参考: https ://api.highcharts.com/highcharts/series.bubble.linkedTo
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript