javascript - Custom Highcharts Context Menu Button Appearing in Every Chart on Page -
i have page several charts, , need able add specific options exporting context menu each chart. code using:
mychart.options.exporting.buttons.contextbutton.menuitems.push({ text: "custom option", onclick: somefunction });
unfortunately, adds option every chart, not chart mychart references. i'd able add option , have appear on 1 chart.
here fiddle demonstrates: http://jsfiddle.net/4up5y/2/
thanks!
to add button use options chart. can set each chart different set of options: http://jsfiddle.net/4up5y/4/
get default buttons:
var buttons = highcharts.getoptions().exporting.buttons.contextbutton.menuitems; buttons.push({ text: "tokyo option", onclick: helloworld });
and set them chart:
exporting: { buttons: { contextbutton: { menuitems: buttons // or buttons.slice(0,6) } } },
Comments
Post a Comment