baidu / baidu/amis

通过JSON配置ECharts时,函数如何传入外部参数

Open
#6,201 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

#### 实现场景:
ECharts中的数据显示格式需要根据API获取的值类型显示。

#### 存在的问题:
无法将API获取的值传入到formatter的function中

#### 当前方案:

```
{
"type": "page",
"body": {
"type": "chart",
"api": "/api/....",
"config": {
"legend": {
"formatter": "function (name) { return 'Legend ' + name;}"
},
"yAxis": {},
"series": [
{
"type": "bar",
"seriesLayoutBy": "row"
}
]
}
}
}
```

![企业微信截图_16765646493748](https://user-images.githubusercontent.com/107041272/219427478-942c56e8-ebbf-4b99-b92d-8e2a2f6fbc6f.png)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the chart's JSON config and API data are handled, focusing on the ECharts formatter example in the issue. Determine whether the requested external API value can be made available to formatter functions, and consider the work complete when the documented configuration supports that value and the formatter behavior is verified.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.