Skip to content

折线图中设置tooltip formatter如何只在左右平移的时候触发该事件这个2.0和3.0事件不一样是BUG吗 #9831

@luanxinwei

Description

@luanxinwei

折线图中设置axisPointer type为cross tooltip formatter 在2.0中只能在移动到相应有点的位置才能触发formatter事件,但是在3.0后只要坐标改变都会触发formatter事件,这个是不是个bug,我现在只希望在移动到相应点并且只有左右平移的时候触发此事件。

option = {
color: colors,
tooltip : { // Option config. Can be overwrited by series or data
trigger: 'axis',
axisPointer: {
type: 'line',
axis:'x',
label:{
show:true,
formatter: 'some text {value} some text'
}
},
formatter: function (params,ticket,callback) {
console.log(params)
setTimeout(function (){
// 仅为了模拟异步回调
callback(ticket, '2312');
}, 10)
return 'loading';
}
},
legend: {
data:['2015 降水量', '2016 降水量']
},
xAxis: [
{
type: 'category'
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name:'数据1',
type:'line',
data:[
['2018-01-01', 10], ['2018-01-02', 7], ['2018-01-03', 8]
]
},
{
name:'数据2',
type:'line',
data:[
['2018-01-02', 2], ['2018-01-04', 3], ['2018-01-05', 2]
]
}
]
};
@kener

Metadata

Metadata

Assignees

Labels

pendingWe are not sure about whether this is a bug/new feature.staleInactive for a long time. Will be closed in 7 days.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions