When the page content is printed with the Echars chart, the chart does not display

because my Echars is bound to div, it is not easy to print directly. It is said on the Internet that I want to convert the chart into picture format and skip pages, but the specific operation is not very detailed, and I do not quite understand how to achieve it. Then I try to bind it directly to canvas, but the page effect of Echars is gone, and the horizontal and vertical coordinates of legend information are also gone when printing. Here are the methods I currently use. So how to change it now

function print_voucher () {/ / the main method of printing

       var win=window.open();
       win.document.write("<br><img src=""+canvas.toDataURL("image/png")+""/>");
       win.print();
       win.location.reload();
   }

   $(function(){

       var canvas=document.getElementById("bar_left");
       var ctx=canvas.getContext("2d");
       ctx.fillStyle="gold";
       ctx.strokeStyle="blue";
       ctx.lineWidth=5;
       ctx.scale(2,2);
       ctx.rect(50,50,100,100);
       ctx.fill();
       ctx.stroke();
       function print_voucher(){
           var win=window.open();
           win.document.write("<br><img src=""+canvas.toDataURL()+""/>");
           win.print();
           win.location.reload();
       }

       $("-sharpprintVoucher").click(function(){ print_voucher(); });
Jun.11,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37651-2c081.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37651-2c081.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?