Open pedrocleto opened 5 years ago
Destroy shouldn't be called in this function it is causing all problems with exporting
As a workaround you do this to your chart options: ... exporting { ... menuItemDefinitions: {"printChart": {}, "separator": {}, "downloadPNG": { onclick : function() { this.exportChart(); this.options.reload(); }}, "downloadJPEG": { onclick : function() { this.exportChart({type: 'image/jpeg'}); this.options.reload(); } }, "downloadPDF": { onclick : function() { this.exportChart({type: 'application/pdf'}); this.options.reload(); }}, "downloadSVG": { onclick : function() { this.exportChart({type: 'image/svg+xml'}); this.options.reload(); } }} } ... options['reload'] = () => { this.chart= new Chart(options); } ...
What is the status of this bug? Are you planning to work on it?
Im also having this issue, will this bug be fixed?
As a workaround you do this to your chart options: ... exporting { ... menuItemDefinitions: {"printChart": {}, "separator": {}, "downloadPNG": { onclick : function() { this.exportChart(); this.options.reload(); }}, "downloadJPEG": { onclick : function() { this.exportChart({type: 'image/jpeg'}); this.options.reload(); } }, "downloadPDF": { onclick : function() { this.exportChart({type: 'application/pdf'}); this.options.reload(); }}, "downloadSVG": { onclick : function() { this.exportChart({type: 'image/svg+xml'}); this.options.reload(); } }} } ... options['reload'] = () => { this.chart= new Chart(options); } ...
Does anyone know if this is valid? And if so, can they make it more clear? I don't understand what am I supposed to do with this piece of code... should I reinstantiate every single options chart like every single time after exporting? Or do I need to set those options on every single chart?
I don't understand this workaround or how to implement it
Updated my angular-highcharts to 9.0.11 from 8.0.3 fixed this for me.
This line is causing the chart to break and throw an error when using the export functionality. Using the latest highcharts 7.1.1 and angular-highcharts 7.2.0 https://github.com/cebor/angular-highcharts/blob/29ea31a9520709fde8a19138ba84c428127587a3/projects/angular-highcharts/src/lib/chart.ts#L90
ERROR TypeError: Cannot read property 'forExport' of undefined at a.Chart.destroy (highcharts.js:293) at FlowChart.push../node_modules/angular-highcharts/fesm5/angular-highcharts.js.Chart.destroy (angular-highcharts.js:169) at ChartDirective.destroy (angular-highcharts.js:384) at ChartDirective.ngOnDestroy (angular-highcharts.js:359) at callProviderLifecycles (core.js:20988) at callElementProvidersLifecycles (core.js:20956) at callLifecycleHooksChildrenFirst (core.js:2094