apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser

Home Page:https://echarts.apache.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] 希望 tooltip 的 valueFormatter 增加数据组的 index 值。

zgsyinwu opened this issue · comments

What problem does this feature solve?

在多组数据的折线图中,我需要在每个数据后添加不同的单位,但5.5版本中的dataIndex并不满足此要求。

What does the proposed API look like?

tooltip: {
valueFormatter: (value, dataIndex, classIndex) => {
if (classIndex == 0) {
return value + ' g'
}
return value + ' kg'
}
}

这种请在各自的 series 中添加。

在名称后面加单位吗?那明显不美观

不是,每个 series 也可以设置自己的 valueFormatter,甚至可以为单个数据项设置不同的 valueFormatter

感谢,可以实现