Custom Highcharts Context Menu Button Appearing in Every Chart on Page

前端 未结 4 1497
执笔经年
执笔经年 2021-01-12 10:37

I have a page with several charts, and I need to be able to add specific options to the exporting context menu for each chart. This is the code I am using:

         


        
4条回答
  •  悲哀的现实
    2021-01-12 11:03

    To add button use options for chart. Then you can set for 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 Only Option",
        onclick: HelloWorld
    });
    

    And set them for a chart:

    exporting: {
        buttons: {
            contextButton: {
                menuItems: buttons // or buttons.slice(0,6)
            }
        }
    },
    

提交回复
热议问题