Search code examples
angularionic-frameworkhighchartsionic4ionic5

export button create outside Highchart using Angular and Ionic 5


I am created highchart and I try to put the export button outside the chart. but I didn't get in the ionic angular framework.

I tried to export a chart in SVG. I am gone through this link: http://jsfiddle.net/tLfeaL7y/ In this exporting as javascript: Code: Select all

 $('#export_JPG').click(function() {
    chart.exportChartLocal({
      type: 'image/jpeg'
    });
  });

If there any way to export in IONIC 5 and Angular.

Thank You


Solution

  • Here is a demo shows how to create a custom button which triggers the chart downloading on click in the Angular environment.

    Demo: https://codesandbox.io/s/angular-js9nk

      test = () => {
        console.log(this.Highcharts.charts)
        this.Highcharts.charts[0].exportChart({
          type: 'image/jpeg',
          filename: "line-chart"
        });
      }
    

    API: https://api.highcharts.com/class-reference/Highcharts.Chart#exportChart