Before, I made a request for a relational graph. Because exporting png and other images will be distorted when enlarged, I hope to export them as vector graphs. However, the export graph function that comes with G6 cannot be exported as SVG in Canvas mode, and SVG mode has many features that are not supported, so I tried to find a way to export Canvas as SVG.
This code uses an old library called canvas-to-svg
This library simulates canvas and exposes some canvas apis, which can finally be exported as svg
It should be noted that some canvas APIs do not support, such as setTransform, resetTransform, etc. If you need to use these two APIs, you can split them into translate and rotate, etc