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

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -