Converting Chart.js canvas chart to image using .toDataUrl() results in blank image

前端 未结 7 2008
失恋的感觉
失恋的感觉 2020-11-30 23:57

I am using Chart.js. I am trying to convert the chart to an image by getting a base 64 string. The tutorial (http://www.chartjs.org/docs/) devotes an entire 1 line on the to

7条回答
  •  庸人自扰
    2020-12-01 00:16

    The chart seem to be async so you will probably need to provide a callback when the animation has finished or else the canvas will be empty.

    var options = {
        bezierCurve : false,
        onAnimationComplete: done  /// calls function done() {} at end
    };
    

提交回复
热议问题