javascript - Highcharts 图例索引在图例点击时显示 -1
问题描述
在这个 jsFiddle 中,当除系列 1 之外的所有系列都被取消选择时,它显示为“-1”。这是高图表中的错误还是我做错了什么?我尝试了几件事,例如弄乱偏移量,showEmpty,似乎没有任何效果。有任何想法吗?
http://jsfiddle.net/mhant47c/1/
$('#container').highcharts({
chart: {
type: 'bar'
},
yAxis: [{
width: '33.33%',
showLastLabel: false,
id: 'yA0'
}, {
left: '33.33%',
width: '33.33%',
offset: 0,
showLastLabel: false,
id: 'yA1'
}, {
left: '66.66%',
width: '33.33%',
offset: 0,
id: 'yA2'
}],
plotOptions: {
series: {
stacking: 'normal'
}
},
xAxis:{
showEmpty:false,
categories:['a','b','c','d']
},
series: [{
data: [1, 2, 3, 4]
}, {
data: [3, 2, 1, 6]
},
{
yAxis: 1,
data: [23, 43, 56,23, 43, 56]
},{
yAxis: 1,
data: [23, 43, 56,23, 43, 56]
}, {
yAxis: 2,
data: [123, 413, 516,23, 43, 56]
}]
});
解决方案
该图表试图使列居中,从而添加一个额外的类别。为防止这种情况,请使用min
选项:
xAxis: {
min: 0,
...
},
现场演示:http: //jsfiddle.net/BlackLabel/6p84vx53/
推荐阅读
- quasar-framework - 如何在 Quasar 中全局注册组件?
- python - 如何在 Python 中的线程之间共享数组索引?
- php - get_header() 在自定义页面模板中不起作用
- bit - evenBitParity - 如果 x 的偶数索引位中有奇数个为 0,则返回 1(x 的第 0 位是 1 的位置)
- c - 线程安全队列实现(或替代数据结构)
- momentjs - 如何使用 momentJs 获得正确的时间
- c# - 在将一个应用程序导航到另一个应用程序时需要有关 google SSO 的帮助
- spring-boot - initialDelay 值在运行时获取
- apache-kafka - 如何从嵌套的 JSON 对象创建 KSQLdb 流字段
- flutter - Flutter:CheckboxTile刻度线不变