[Feature] I hope to get all series information when tooltip.trigger = item
Opened this issue · 3 comments
What problem does this feature solve?
tooltip.formatter
方法接受一个 params
参数,当 tooltip.trigger = item
的,params
是当前 hover 的 series data,当 tooltip.trigger = axis
时,params
是一个数组,包含所有的 series data
我需要在 tooltip.trigger = item
的时候,在 tooltip 中也展示所有的 series 信息,所以我希望 tooltip.trigger = item
的,也可以获取到所有的 series data
The tooltip.formatter
method accepts a params. When tooltip.trigger = item
, params
is the series data of the current hover. When tooltip.trigger = axis
, params
is an array containing all series data.
I need to display all series info in the tooltip when tooltip.trigger = item
, so I hope to get all series data when tooltip.trigger = item
.
What does the proposed API look like?
当 trigger = 'item'
时可以新增一个 context 参数:
tooltip: {
trigger: 'item',
formatter: (params, context) => {
console.log(context);
}
}
@li-jia-nan It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗
TRANSLATED
BODY
What problem does this feature solve?
The tooltip.formatter
method accepts a params
parameter. When tooltip.trigger = item
, params
is the series data of the current hover. When tooltip.trigger = axis
, params
is an array. Contains all series data
I need to display all the series information in the tooltip when tooltip.trigger = item
, so I hope that when tooltip.trigger = item
, I can also get all the series data
The tooltip.formatter
method accepts a params. When tooltip.trigger = item
, params
is the series data of the current hover. When tooltip.trigger = axis
, params
is an array containing all series data.
I need to display all series info in the tooltip when tooltip.trigger = item
, so I hope to get all series data when tooltip.trigger = item
.
What does the proposed API look like?
When trigger = 'item'
you can add a context parameter:
tooltip: {
trigger: 'item',
formatter: (params, context) => {
console.log(context);
}
}
The getOption
API is expensive and it's not first recommended. Except for this, I think there is no public API to get such information, but I still post a workaround that uses inner APIs.