@nestjsforge/echarts

Architecture

How @nestjsforge/echarts works internally.

Understanding the internals helps you tune performance and troubleshoot issues.

How rendering works

  1. Your service calls renderToBuffer(option).
  2. The RenderQueue acquires a browser instance from the pool (blocking if all instances are busy).
  3. A new Page is opened in the acquired browser instance.
  4. The ECharts library is loaded and chart.setOption(option) is called inside the page.
  5. A screenshot of the chart container is captured as a PNG buffer.
  6. The page is closed (not the browser — browsers are reused across renders).
  7. The browser instance is returned to the pool.
  8. 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.