apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.15k stars 19.6k forks source link

[Bug] cannot export two connected charts with svg renderer / `getConnectedDataURL` broken with SVG renderer #19278

Open kije opened 10 months ago

kije commented 10 months ago

Version

5.4.3

Link to Minimal Reproduction

https://github.com/kije/echarts/commit/7969c3cd8ef9a92d2ea9d3d60f6e59e2f03fe00f

Steps to Reproduce

  1. create two Echart instances with svg renderer
  2. connect them via echarts.connect()
  3. try to export the charts as svg

Current Behavior

When trying to export two connected charts with svg renderer, the following error occurs:

Uncaught TypeError: Cannot set properties of undefined (setting 'innerHTML')
    at ECharts.getConnectedDataURL (echarts.js:26673:49)

The issue seems to be here https://github.com/apache/echarts/blob/fd9e62d7fdd88e95ddaf3c371353e8f6ca7d9e6a/src/core/echarts.ts#L874-L887

Iv'e added some tests in my fork here that reproduce the issue.

Might have been caused by [Feature] [svg] Refactor SVG renderer. Improved SVG rendering performance by 2x ~ 10x in 5.3.0?

Expected Behavior

SVG export with SVG renderer of connected charts works and does not produce an error.

Environment

- OS: Mac OS 14.0
- Browser: Google Chrome 118.0.5993.117
- Framework: -

Any additional comments?

No response

helgasoft commented 10 months ago

bug confirmed for type: 'svg'. Works ok for default toolbox.feature.saveAsImage.type = 'png'

plainheart commented 10 months ago

Link to #18028. This is a known issue.