-
Notifications
You must be signed in to change notification settings - Fork 19.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add valueFormatter in tooltip #16332
Conversation
Thanks for your contribution! The pull request is marked to be Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the |
@plainheart Because If we return an array. Developers need to check if value is array and loop them to process each one. And they may be confused if they should return an array or a combined string. There are cases that different series need to have different formatted result. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well. LGTM.
Congratulations! Your PR has been merged. Thanks for your contribution! 👍 |
等发正式版,刚试了下 rc,控制台一堆报错。 |
@crazyair 能提供下复现示例吗? |
|
这个能提供最小复现示例吗? |
对,是使用了渐变色,由于示例死循环了非常卡,渐变色我是这样配置的
起始 color 是 options.color[0] 的值 rgb(220 221 251) |
rgb 的逗号呢?还是用法不规范啊... |
尴尬,眼花了,vscode 在这里会有背景色,没看到有没有逗号 |
可能是缓存,清一下缓存刷新再试。 |
感谢,强制刷新后解决了 |
后续可以添加dataIndex吗 |
Brief Information
This pull request is in the type of:
What does this PR do?
This PR added a new option
valueFormatter
. It's the most commonly used formatter scenario we've met. See more detail in #14962API
Parameter
value
is the number or string(category) that displayed in each row. For example, in the following tooltip:Each row will call the
valueFormatter
once and the value will be0.3
,12.71
,0
respectively.NOTE:
valueFormatter
will take no effect ifformatter
is used.Fixed issues
#14962
#15430
Details
Before: What was the problem?
We need to replace the whole HTML with formatter if we only want format the numbers.
After: How is it fixed in this PR?
Use
valueFormatter
to only format the numbers.Misc
Related test cases or examples to use the new APIs
Basic usage: adding %
Using different formatter in different series.
Others
Merging options
Other information