baidu / baidu/amis

chart的formatter中无法获取amis上下文data中的数据

Open
#3,591 1 comment 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

#### 是否关联于某个问题吗:
在使用chart中,希望对formatter做一些自定义,但是在自定义的函数中无法获取到数据,就没有办法根据数据来做一些渲染。
特别是在legend.formatter中,因为只有一个name参数。

#### 预期的解决方案:
在Chart.tsx中recoverFunctionType方法。做了函数的转换,这里是不是可以做一个闭包?把上下文的数据转给自定义函数?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in Chart.tsx at recoverFunctionType, where chart formatter functions are converted. Trace how formatter callbacks, especially legend.formatter, are invoked and determine how the amis context data should reach them. Done means a custom formatter can access the relevant context data for data-dependent rendering.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.