阅读(2089) (0)

显示和隐藏ECharts提示框

2017-08-28 17:39:43 更新

action.tooltip  |  *

提示框组件相关的行为,必须引入提示框组件后才能使用。

action.tooltip.showTip  |  Action

显示提示框。

有下面两种使用方式。

1 指定在相对容器的位置处显示提示框,如果指定的位置无法显示则无效。

dispatchAction({
type: 'showTip',
// 屏幕上的 x 坐标
x: number,
// 屏幕上的 y 坐标
y: number,
// 本次显示 tooltip 的位置。只在本次 action 中生效。
// 缺省则使用 option 中定义的 tooltip 位置。
position: Array.<number>|string|Function
})

2 指定数据图形,根据 tooltip 的配置项显示提示框。

dispatchAction({
type: 'showTip',
// 系列的 index,在 tooltip 的 trigger 为 axis 的时候可选。
seriesIndex?: number,
// 数据的 index,如果不指定也可以通过 name 属性根据名称指定数据
dataIndex?: number,
// 可选,数据名称,在有 dataIndex 的时候忽略
name?: string,
// 本次显示 tooltip 的位置。只在本次 action 中生效。
// 缺省则使用 option 中定义的 tooltip 位置。
position: Array.<number>|string|Function,
})

参数position同tooltip.position相同。

action.tooltip.hideTip  |  Action

隐藏提示框。

dispatchAction({
type: 'hideTip'
})