antvis/G2

On Rendered / done event #2310

przemo098 posted onGitHub

Hello guys I'm trying to capture base64Image from canvas, like this:

   chart.render();
   const base64Url = document.getElementsByTagName('canvas')[0].toDataURL();

It returns black value... (it seems that it's still not rendered)

However this value is valid after some time after calling:

   chart.render();
   setTimeout(() => {
      const base64Url = document.getElementsByTagName('canvas')[0].toDataURL();
    }, 1500);

Is there any hook / callback / event when the chart is rendered ? I've found few events in documentation however I stuck..

Also it would be great to add functionality to render exactly to base64 skiping the canvas rendring ( I saw that you guys got SVG / Canvas renderers)

  • G2 Version: 4.06
  • Platform: Chrome

I saw simillar issue: https://github.com/antvis/G2/issues/1141 It seems that something is wrong...


Fund this Issue

$0.00
Funded

Pull requests