primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Chart - export as base64Image return empty

Open lukgit17 opened this issue 8 years ago • 1 comments

I'm submitting a ... (check one with "x")

[ ] bug report => Search github for a similar issue or PR before submitting [ x] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap [ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior Chart export empty image.

Expected behavior

  • in html chart is defined as below : <p-chart #chartCons type="line" [data]="dataChart[0]" [responsive]="true" [options]="options[0]">

  • in ts file : @ViewChild('chartCons') chartCons: UIChart;

    setTimeout(() => { var image = this.chartCons.getBase64Image(); },50);

  • console log return : data:,

    PrimeNG version: 5.2.1 Chart.js version : 2.7.1 Angular : 5.2.0

    Language: TypeScript 2.4.0

lukgit17 avatar Mar 08 '18 08:03 lukgit17

Workaround is to put in options below code : animation: { duration: 50, // general animation time onComplete: function (animation) { this.toBase64Image(); }

and increase setTimeout time when run getBase64Image()

lukgit17 avatar Mar 08 '18 09:03 lukgit17