apache / apache/echarts

[Bug] graphic下,type: 'text'中,style.fontSize使用不同单位,行为不同

Open
#18,513 7 comments 0 reactions 0 assignees View on GitHub
bug difficulty: easy
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version

5.3.2

### Link to Minimal Reproduction

none

### Steps to Reproduce

option = {
graphic: {
elements: [
{
type: 'group',
left: 'center',
top: 'center',
children: [
// 非正常: 左侧会有空隙
{
type: 'text',
style: {
text: 'Apache ECharts',
fontSize: '2em',
fill: '#000',
stroke: '#000',
},
},
// 正常
// {
// type: 'text',
// style: {
// text: 'Apache ECharts',
// fontSize: '24px',
// fill: '#000',
// stroke: '#000',
// },
// }
],
},
]
}
};

### Current Behavior

![251681526414_ pic](https://user-images.githubusercontent.com/23701496/232179636-aaacd92e-5ea0-4a71-87e6-f1733985f679.jpg)
![261681526415_ pic](https://user-images.githubusercontent.com/23701496/232179656-5400c938-33ec-43ab-94a7-cd433ec06702.jpg)

### Expected Behavior

期望:fontSize使用'em'做单位, 左侧会多出一段空白;希望行为和'px'一致。

### Environment

```markdown
- OS: macOS Monterey
- Browser: Chrome 111.0.5563.146(正式版本) (arm64)
- Framework: none
```

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