apache / apache/echarts

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

Open
#19,278 3 comments 0 reactions 0 assignees View on GitHub
bug en stale SVG
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### 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:

```console
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](https://github.com/kije/echarts/commit/7969c3cd8ef9a92d2ea9d3d60f6e59e2f03fe00f) 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](https://github.com/apache/echarts/releases/tag/5.3.0)?

### Expected Behavior

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

### Environment

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

### Any additional comments?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.