@nestjsforge/echarts
Architecture
How @nestjsforge/echarts works internally.
Understanding the internals helps you tune performance and troubleshoot issues.
How rendering works
- Your service calls
renderToBuffer(option). - The RenderQueue acquires a browser instance from the pool (blocking if all instances are busy).
- A new Page is opened in the acquired browser instance.
- The ECharts library is loaded and
chart.setOption(option)is called inside the page. - A screenshot of the chart container is captured as a PNG buffer.
- The page is closed (not the browser — browsers are reused across renders).
- The browser instance is returned to the pool.
- The buffer is returned to the caller.
Graceful shutdown
On NestJS onApplicationShutdown, the module waits for all in-flight renders to complete (up to gracefulShutdownTimeout ms), then closes all browser instances.