'Use toDataUrl 4 times or more, window.print causes a freezing tab in Chrome
I want to print charts from chartJs. For this purpose, I use the function document.getElementById('myChart').toDataURL();. The element of the id is my canvas, that is created by chartJs. Then, I build the content that I want to print. Later on, I print them using the function window.open().print().
At the beginning, it was working fine using one or two charts. But as soon as I add to the content a 4th chart, my Tab is freezing in Chrome. So I cant act in the form anymore and I have to close the Tab.
I created a jsFiddle to demonstrate it. To see the problem, you have to click on the "please print me" button.
Here is a running version, where I just print 3 Charts. You can print it as often as you want and you can use the select next to it: https://jsfiddle.net/u49e7qmL/2/
Here is a not running version, where I just print 4 Charts. As soon as you click on print, the tab makes a problem. You cannot print a 2nd time. Additionally you cannot use the select next to it. In my application, the whole tab freezes: https://jsfiddle.net/u49e7qmL/3/
What do I have to do that I can keep using the tab like when I print with just 3 elements?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
