apache / apache/echarts

How to dynamically add images to the rich text of the label on the node?

Open
#15,948 8 comments 3 reactions 0 assignees View on GitHub
en pending support waiting-for: author
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
15h 17m
Merged PRs (30d)
5

Description

### What problem does this feature solve?
Lable rich text on nodes can now be dynamically displayed with text, but images cannot be dynamically defined in Rich, so dynamic image addresses cannot be passed as text. All new features that can be added to dynamically transfer image addresses like text?

### What does the proposed API look like?
```js
formatter: (userInfo)=>{
if(data.relate_id){
return '{img|userInfo.image}' '{name_main|' userInfo.name '}';
}else{
return '{name_main|' userInfo.name '}';
}
},
rich: {
name_main: {
color: 'blue',
lineHeight: 10,
verticalAlign: "middle"
},
img: {
backgroundColor: {
},
position: 'center',
height: 10
}
}
```
The address of the image in userInfo.image can then be passed to the image in the IMG style to dynamically display the image.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the formatter and rich-text configuration shown in the issue, focusing on how text and image styles are currently passed to node labels. Define the behavior for resolving a dynamic image address from userInfo.image, then verify that a node label can render the resulting image alongside its dynamic text.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.