apache / apache/echarts

[Feature] Hope "tooltip" supports "rich". 希望“tooltip”支持“rich”

Open
#17,543 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### What problem does this feature solve?

目前`tooltip`不支持`rich`,`renderMode:'richText'`似乎是一个没用的选项,在没有dom的微信小程序里,没办法自定义不同的样式。
Currently, `rich`is not supported by`tooltip`, and`renderMode:'richText'`seems to be a useless option. In wechat applets without DOM, there is no way to customize different styles.
```js
option = {
tooltip: {
renderMode: 'richText',
formatter({ name, value }) {
return `{name|${name}}:{value|${value}}`;
},
// invalid 无效
rich: {
name: { color: 'red' },
value: { color: 'blue' }
},
textStyle: {
// invalid 无效
rich: {
name: { color: 'red' },
value: { color: 'blue' }
}
}
},
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [
{
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar'
}
]
};
```

### What does the proposed API look like?

`tooltip.rich`
or
`tooltip.textStyle.rich`

Contributor guide

Open the contributing guide

Research direction

Start by tracing how tooltip's renderMode:'richText' path consumes formatter output in the WeChat mini-program/no-DOM renderer. Verify that the chosen tooltip.rich or tooltip.textStyle.rich API applies named styles to the {name|...} and {value|...} output, and confirm the example renders distinct colors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.