javascript - Add buttons in chart of Highcharts at runtime -
i need add custom buttons (with onclick events), without overwrite exporting buttons value, 'cause wanna include new buttons without lost custom buttons defined in chart (my chart has custom buttons defined), @ runtime, in highcharts chart using object:
$('container').highcharts()
is possible?
you can add custom buttons using exporting object:
exporting: { buttons: { custombutton: { text: 'custom button', onclick: function () { alert('you pressed button!'); } }, anotherbutton: { text: 'another button', onclick: function () { alert('you pressed button!'); } } } } edit: wanted add buttons after config
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(); new fiddle: http://jsfiddle.net/nxk39/2/ answer using technique highcharts: replace custom button image on hover
Comments
Post a Comment