我需要添加一些自定义按钮(带有 onclick 事件),而不覆盖导出按钮值,因为我想包含新按钮,而不会丢失图表中先前定义的自定义按钮(我的图表已经定义了自定义按钮),所有这些都在运行时进行,在使用此对象的 Highcharts 图表中:
$('容器').highcharts()
这可能吗?
您可以使用导出对象添加自定义按钮:
exporting: {
buttons: {
customButton: {
text: 'Custom Button',
onclick: function () {
alert('You pressed the button!');
}
},
anotherButton: {
text: 'Another Button',
onclick: function () {
alert('You pressed another button!');
}
}
}
}
http://jsfiddle.net/NxK39/1/
编辑:
他想在配置后添加按钮
var chart = $('#container').highcharts();
normalState = new Object();
normalState.stroke_width = null;
normalState.stroke = null;
normalState.fill = null;
normalState.padding = null;
normalState.r = null;
hoverState = new Object();
hoverState = normalState;
hoverState.fill = 'red';
pressedState = new Object();
pressedState = normalState;
var custombutton = chart.renderer.button('button', 74, 10, function(){
alert('New Button Pressed');
},null,hoverState,pressedState).add();
新小提琴:http://jsfiddle.net/NxK39/2/使用技术回答Highcharts:替换悬停时的自定义按钮图像
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)