apache / apache/echarts

treemap 设置 rich 后整体label不水平垂直居中

Open
#14,502 18 comments 2 reactions 0 assignees View on GitHub
bug topic: label topic: richText
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version
5.0.2

### Steps to reproduce
1、打开地址:https://echarts.apache.org/examples/en/editor.html?c=treemap-disk
2、输入以下option:

```javascript
option = {
series: [{
type: 'treemap',
name: '中国',
leafDepth: 1,
label: {
formatter: '{b}',
rich:{}, // 只要加上这句话,即使rich是空的,定位也会不居中
},
data: [{
name: '河北省', // First tree
value: 10,
children: [{
name: '邯郸市', // First leaf of first tree
value: 4
}, {
name: '保定市', // Second leaf of first tree
value: 6
}],
}, {
name: '河南省', // Second tree
value: 20,
children: [{
name: '郑州市', // Son of first tree
value: 20,
children: [{
name: 'xxx县', // Granson of first tree
value: 20
}]
}]
}]
}]
};
```

3、只要加上了 rich: {},即使是空的,label定位也有问题。不加的时候是水平垂直居中的,加上后变为lefttop 布局,设置 verticalAlign: "middle" 也不生效

### What is expected?
希望“河北省”、“河南省”在块中是居中的

### What is actually happening?
实际上跑到左上角了

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue in the linked ECharts treemap-disk example using the supplied option, first comparing the label layout with and without an empty rich object. Trace the treemap label positioning and rich-text handling; done means the province labels remain horizontally and vertically centered when rich:{} is present, with verticalAlign working as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.