Converting Chart.js canvas chart to image using .toDataUrl() results in blank image
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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 topic: The canvas element also allows for saving the contents as a base 64 string, allowing saving the chart as an image. A canvas element has the method of toDataURL , which returns a base64 string of the image. However, when I do that, the image it renders is just a transparent rectangle with the dimensions of the chart, and it does not include the chart contents. Here