How to use a custom download button with default p

2019-09-09 03:13发布

问题:

I'd like to use a custom printing button for my Highcharts graph. Now, I succeeded in adding it, however, I don't know how to make it display those default printing options (Export as PNG, SVG, JPG, PDF). And how to make disappear that default printing button.

This is the code:

    exporting: {
        buttons: {
            'myButton': {
                _id: 'myButton',
                symbol: 'url(http://geodev.grid.unep.ch/images/button_download.png)',
                onclick: function () {
                    alert('click!')
                }
            }
        }
    }

And here is a fiddle.

Is there any simple approach for that in the "onClick" event it says: "Display all print options"?

Thanks for any suggestions!

回答1:

As Sebastian showed in his example (I deleted a few unnecessary commands), no need to reinvent the wheel, but just to replace the default image is sufficient:

    exporting: {
        buttons: {
            contextButton: {
                symbol: 'url(http://geodev.grid.unep.ch/images/button_download.png)'
            }
        }
    }