export-csv icon indicating copy to clipboard operation
export-csv copied to clipboard

Provide a way to disable the plugin if it's loaded on a page

Open wwuck opened this issue 9 years ago • 2 comments

I sometimes have multiple charts on the same page where only some of them should be exportable to CSV/XLS, but all of them can be exported to PNG or other image types.

Can there be an option added to this plugin to disable CSV/XLS export so the CSV/XLS items are not added to the exporting menu button? Perhaps exporting.csv.enabled?

I have tried setting this option, but it still lets me export an empty file:

plotOptions:{
    series: {
        includeInCSVExport: false
    }
}

wwuck avatar Jan 05 '16 04:01 wwuck

Currently, the menu items are not pushed to each chart item, but to the default options for menu items. So in order to implement this we would need to change the menu items are handled in the options.

You can do this currently by adding chart-specific menuItem options, so that you slice away the last two items for individual charts:

    exporting: {
        buttons: {
            contextButton: {
                menuItems: Highcharts.getOptions().exporting.buttons.contextButton.menuItems.slice(0, 6)
            }
        }
    }

View it live on jsFiddle.

TorsteinHonsi avatar Jan 05 '16 09:01 TorsteinHonsi

That's exactly what I was looking for. Thanks!

wwuck avatar Jan 05 '16 23:01 wwuck