简体   繁体   English

ECharts-为每个数据点启用工具提示,但跳过xAxis标签

[英]ECharts - enable tooltip for every data point, but skip xAxis labels

Not sure whether this will get answered, since ECharts isn't popular relative to other charting libraries, but here I go. 不确定是否会得到回答,因为相对于其他图表库而言,ECharts并不流行,但是我在这里。

There is an example chart 有一个示例图表

http://ecomfe.github.io/echarts/doc/example/axis.html#-en http://ecomfe.github.io/echarts/doc/example/axis.html#-en

Now what I want to do is, enable every point as a tooltip, but skip the displaying of xAxis labels. 现在我要做的是,将每个点都作为工具提示,但是跳过xAxis标签的显示。

So, I can display all the tooltips by setting 因此,我可以通过设置来显示所有工具提示

  xAxis : [{
    axisLabel:{
      interval:0
    }
  }]

That works well. 那很好。 But it also shows every xAxis label. 但是它还会显示每个xAxis标签。 I want to display every 2nd xAxis label, so if I change to 我想显示每个第二个xAxis标签,所以如果我更改为

  xAxis : [{
    axisLabel:{
      interval:1
    }
  }]

Now I only see tooltips of every 2nd data point. 现在,我仅看到每个第二个数据点的工具提示。

Is there a way to enable tooltip for every data point but skip the labels as I wish? 有没有一种方法可以为每个数据点启用工具提示,但可以根据需要跳过标签?

I guess what you say every point as a tooltip means tooltip will appear when mouse hovered on a bar of bar chart, or a circle symbol of line chart. 我想您所说的每个提示都表示工具提示,这意味着当鼠标悬停在条形图的条形图或折线图的圆形符号上时,将显示工具提示。 If so, you can change the tooltip trigger to 'item'. 如果是这样,您可以将工具提示触发器更改为“ item”。

tooltip : {
    trigger: 'item'
},

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM