Skip to content

tooltip采用坐标轴触发时,鼠标在图表无数据区域移动,会触发最近的数据点 #7408

@zhang122622623

Description

@zhang122622623

One-line summary [问题简述]

图表中包含折线图和散点图,x轴为时间轴,显示0:00-24:00的数据, tooltip采用坐标轴触发,鼠标移动到图表无数据位置,会触发最近的数据点;
例如:当图表从10:00开始有数据时,鼠标移动到10点之前的任意位置,都会触发10:00的这个数据点;若tooltip指示线为自动吸附时,此时指示线一直吸附在10:00的位置;指示线不设置自动吸附(snap:false)时,指示线会随着鼠标移动,但是仍然会触发10:00的数据点;

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]:
  • Browser version [浏览器类型和版本]:
  • OS Version [操作系统类型和版本]:

echarts: 3.6.2;
浏览器:chrome 61;
操作系统:win7;

Expected behaviour [期望结果]

当鼠标在无数据区域移动,不触发最近的数据点;

ECharts option [ECharts配置项]

option = {
``    tooltip:{
               trigger:'axis',
               axisPointer:{
                 type:'line',
                 axis:'x',
                 lineStyle:{color:'#333',}
               },
               backgroundColor:'#555',
               formatter:function(params){
                   let tip = auth.formatterTip(params);
                   return tip ;
               },
            },
  xAxis: [{
              type: 'time',
              boundaryGap: false,
              min:new Date(this.timeSection[0]*1000),
              max:new Date(this.timeSection[1]*1000),
              interlval:0,
              axisLabel: {show:false,},
              axisLine: {lineStyle: {color: '#ccc'}},
              splitNumber: 24,
            }],
}

Other comments [其他信息]

详细信息和效果图看这:https://segmentfault.com/q/1010000012680575

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleInactive for a long time. Will be closed in 7 days.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions