我想一次自定义检查和取消选中图例元素,我不知道,我们可以这样做吗?让我知道这样做的方法..
这是一个使用一系列外部控件执行此操作的示例,以及包含图例项和复选框的各种其他内容:
http://jsfiddle.net/simo/57SR9/94/
功能:
$('#checkAll').click(function(){
for(i=0; i < chart.series.length; i++) {
if(chart.series[i].selected == false){
chart.series[i].select();
showSeries.call(chart.series[i], {checked: true});
}
}
});
您可以遍历图表中的每个系列并调用show()
或hide()
函数,具体取决于您要执行的操作。此解决方案与之前的答案类似,但使用show
/ hide
函数调用
i = 0;
while (i < chart.series.length) {
if (chart.series[i].visible === false) { // here you can filter the visible series
chart.series[i].select();
chart.series[i].show(); // here you can call hide()
i++;
return;
}
}
你可以使用这样的东西:
var legendLeft = $j('<div>')
.css({
width: 160,
maxHeight: 210,
padding: 10,
position: 'absolute',
overflow: 'auto',
right: 500,
top: 380,
borderRadius: options.borderRadius
})
.appendTo(chart.container);
var legendRight = $j('<div>') .css({
width: 260,
maxHeight: 210,
padding: 10,
position: 'absolute',
overflow: 'auto',
right: 165,
top: 383,
borderRadius: options.borderRadius
}).appendTo(chart.container);
检查一下:http://highslide.com/forum/viewtopic.php?f=9&t=15782