New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSR (Server-Side Rendering & Canvas) #5641
Comments
There is something missing in the doc. You should also inject |
I am sorry @pearmini but I need your help.
As I wrote, my goal is to get SVG or Image for PDF export. |
I took some code from https://github.com/antvis/G2/pull/4123/files.
=>
|
@JonasJonny, is it OK that I provide a demo or a tool to help you in this week? |
Sure, that would help. Thanks |
@JonasJonny, I wrote an example using JSDOM in SSR: Here are the steps to implement it:
If you want to generate PNG instead of SVG, here's another example doing SSR with |
@JonasJonny Sorry for the late reply. Here is SSR tool for G2: https://github.com/pearmini/g2-ssr-node |
Thank you @xiaoiver and @pearmini. Both approaches still require a downgrade to |
What is D2? |
I can build a ESM version for https://github.com/pearmini/g2-ssr-node |
@pearmini I think you already invested a lot of your time. |
Sure, but I think the refactor is not required. You server can remain commonjs if you build a commonjs version of G2 and G. |
Unfortunately security of my project cannot accept Vulnerabilities of d3 In the end I wrote script to replace all Once again Thank you @pearmini for your time. I learned a lot. |
G2 Version: "@antv/g2": "^5.1.5",
Good evening,
I wanted to try SSR with Canvas but without luck.
I followed test code
from https://github.com/antvis/G2/blob/10a4b51e65fe58c68105118736a65870acc91550/__tests__/unit/ssr/index.spec.ts but receiving
I tried
await canvas.ready;
as https://github.com/antvis/G/blob/next/__tests__/integration/__node__tests__/canvas/text.spec.js#L39 with the same result :(.I want to export chart to PDF for report purpose and I need to somehow get the canvas/SVG code on server.
The text was updated successfully, but these errors were encountered: