简体   繁体   中英

Echarts - On hover axisLabel show Tooltip

Echarts- How to Show tooltip Onhover axislabel, for horizontal and vertical bar echart if axis-label text is too long.

Instead of making mouse hover to trigger a tooltip, I managed to come up with the following similar way for handling this issue. Hope this helps.

option = {
  tooltip: {
    trigger: 'item',
    axisPointer: { type: 'cross' }
  },
  xAxis: {
    type: 'category',
    data: ['Mon', 'TuesdayTuesday', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    axisLabel: {
      rotate: 90,
      width: 50,
      ellipsis: '...',
      overflow: 'truncate'
    }
  },
  yAxis: {
    type: 'value'
  },
  series: [
    {
      data: [150, 230, 224, 218, 135, 147, 260],
      type: 'line'
    }
  ]
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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