为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

POPMUISE 2023-07-14 16:39:39
我正在使用 highcharts 来呈现柱形图。由于它是分组堆叠柱形图,目前我得到的图例名称重复,正如您在小提琴中看到的那样: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"            }]        });    });这可能吗
查看完整描述

1 回答

?
慕桂英4014372

TA贡献1871条经验 获得超13个赞

使用linkedTo属性:


series: [{

  ...,

  id: 'john'

}, {

  ...,

  id: 'fem'

}, {

  ...,

  linkedTo: 'john'

}, {

  ...,

  linkedTo: 'fem'

}, {

  ...,

  linkedTo: 'john'

}, {

  ...,

  linkedTo: 'fem'

}]

现场演示: http: //jsfiddle.net/BlackLabel/a4sog5xb/


API 参考: https ://api.highcharts.com/highcharts/series.bubble.linkedTo


查看完整回答
反对 回复 2023-07-14
  • 1 回答
  • 0 关注
  • 75 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信