apache / apache/echarts

[Bug] the tooltip of generated svg using renderToSVGString is not working.

Open
#21,534 1 comment 0 reactions 0 assignees View on GitHub
bug en pending
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.2.2

### Link to Minimal Reproduction

n.a.

### Steps to Reproduce

use the same option (configure render to svg) in [playground](https://echarts.apache.org/examples/en/editor.html?c=area-pieces) and renderToSVGString.

```js
option = {
tooltip: { trigger: 'item' },
xAxis: {
type: 'category',
data: ['Apple', 'Banana', 'Orange', 'Melon', 'Grape']
},
yAxis: { type: 'value' },
series: [
{
name: 'Sales',
type: 'bar',
data: [120, 200, 150, 80, 70],
itemStyle: { color: '#5470c6' },
emphasis: { itemStyle: { color: 'Orange' } },
label: { show: true, position: 'top' }
}
]
};
```

### Current Behavior

the svg in playground is highlight and tooltip enabled. But open the generated svg in browser, only highlight, the tooltip is not working as expected.

I did some research, the highlight works because the gnerated svg of renderToSVGString contains some embeded css styles. And the tooltip maybe need some embeded js which is missing now.

Here is an example svg embeded some js for tooltip demo.

![Image](https://github.com/user-attachments/assets/6999ec04-6b6c-456d-ae9d-19739a0631dc)

svg source:

```xml

```

### Expected Behavior

the tooltip of generated svg using renderToSVGString is working like the normal usage. Maybe need to embed some js to svg.

### Environment

```markdown
- OS: windows
- Browser: edge, chrome
- 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.