score:1

in chatoptions we can write customize options in the high-charts menu we can customize the dropdown options.
in chart options, we can write like:

exporting: {
    buttons: {
      contextbutton: {
        menuitems: ['downloadpng', 'downloadjpeg', 'downloadpdf', 'downloadsvg'],
      },
    },
}

example: click here
reference: click here

score:2

you can remove unnecessary options the following way:

if (highcharts.getoptions().exporting) {
    let contextbutton = highcharts.getoptions().exporting.buttons.contextbutton;
    contextbutton.menuitems = contextbutton.menuitems.filter((item) => {
        return item.textkey === 'downloadjpeg' || item.textkey === 'downloadpng';
    });
}

score:26

you can manually set exporting.buttons.contextbutton.menuitems (api) to contain whatever buttons you want.

you'll want to set it to only contain jpg and png like this (short form, textkey only):

menuitems: ['downloadpng','downloadjpeg']

or for more explicit function calls (long form with objects and onclick):

menuitems: [{
    textkey: 'downloadpng',
    onclick: function () {
        this.exportchart();
    }
}, {
    textkey: 'downloadjpeg',
    onclick: function () {
        this.exportchart({
            type: 'image/jpeg'
        });
    }
}]

as in these jsfiddle demonstrations: short form and long form.

the default for exporting.js is:

menuitems: [{
    textkey: 'printchart',
    onclick: function () {
        this.print();
    }
}, {
    separator: true
}, {
    textkey: 'downloadpng',
    onclick: function () {
        this.exportchart();
    }
}, {
    textkey: 'downloadjpeg',
    onclick: function () {
        this.exportchart({
            type: 'image/jpeg'
        });
    }
}, {
    textkey: 'downloadpdf',
    onclick: function () {
        this.exportchart({
            type: 'application/pdf'
        });
    }
}, {
    textkey: 'downloadsvg',
    onclick: function () {
        this.exportchart({
            type: 'image/svg+xml'
        });
    }
}]

the additional ones for export-data.js are:

menuitems: [{
    textkey: 'downloadcsv',
    onclick: function () {
        this.downloadcsv();
    }
}, {
    textkey: 'downloadxls',
    onclick: function () {
        this.downloadxls();
    }
},{
    textkey: 'viewdata',
    onclick: function () {
        this.viewdata();
    }
},{
    textkey: 'openincloud',
    onclick: function () {
        this.openincloud();
    }
}]

Related Query

More Query from same tag