[Vuejs]-Combine server side exporting and client side exporting in Highcharts (Vue)

1👍

Modules are initialized globally and since you have only one Highcharts instance in your project, offline-exporting is auto-enabled for each component.

Under the hood, the module redefines menuItemDefinitions and uses exportChartLocal instead of exportChart method. You can simply reverse back this behaviour for individual charts, by adding the below configuration:

  exporting: {
    menuItemDefinitions: {
      downloadPNG: {
        textKey: 'downloadPNG',
        onclick: function() {
          this.exportChart();
        }
      },
      downloadJPEG: {
        textKey: 'downloadJPEG',
        onclick: function() {
          this.exportChart({
            type: 'image/jpeg'
          });
        }
      },
      downloadPDF: {
        textKey: 'downloadPDF',
        onclick: function() {
          this.exportChart({
            type: 'application/pdf'
          });
        }
      },
      downloadSVG: {
        textKey: 'downloadSVG',
        onclick: function() {
          this.exportChart({
            type: 'image/svg+xml'
          });
        }
      }
    }
  }

Live demo: http://jsfiddle.net/BlackLabel/bgk5ftaj/

API Reference: https://api.highcharts.com/highcharts/exporting.menuItemDefinitions

Leave a comment