echarts API 图表有一需求就是在柱形图表显示的时候 自动在第一个,柱状图的顶部显示 提示框,但是显示提示框显示了却不在顶部
这是文档
https://echarts.apache.org/zh/api.html#action.tooltip.showTip
下面是我的代码
/*dispatchAction({
type: 'showTip',
// 系列的 index,在 tooltip 的 trigger 为 axis 的时候可选。
seriesIndex?: number,
// 数据项的 index,如果不指定也可以通过 name 属性根据名称指定数据项
dataIndex?: number,
// 可选,数据项名称,在有 dataIndex 的时候忽略
name?: string,,
// 本次显示 tooltip 的位置。只在本次 action 中生效。
// 缺省则使用 option 中定义的 tooltip 位置。
position: number[] | string | Function,
})*/
// 1.显示提示框
myChart.dispatchAction({
type: "showTip", // 触发的action type
seriesIndex: 0, // 系列的 索引
dataIndex: 0,// 数据项的 索引
position: () => {
return 'top'
}, // top
});
下面是效果

想知道怎么配置