This demo shows how you can add custom items that invoke your own JavaScript functions to chart's Export menu.
First, we are going to include a file export.config.default.js
which mirrors the default Export menu functionality in a global variable AmCharts.exportCFG
.
The file is located in plugin's examples
sub-directory:
<script src="https://www.amcharts.com/lib/3/plugins/export/examples/export.config.default.js"></script>
Then, we are going to alter the AmCharts.exportCFG
variable, by pushing one extra item into it:
AmCharts.exportCFG.menu[0].menu.push({ "label": "My action", "click": function() { alert("Clicked my custom item. Wow cool!"); } });
And finally, we're going to use our modified variable as an export
config:
var chart = AmCharts.makeChart("chartdiv", { // ... "export": AmCharts.exportCFG });
There you go - a custom item.