echarts 图表提示框悬浮后超出内容区

470 阅读1分钟

将 tooltip 选项 confine 设置为 true

image.png

   
   const option = {
       ...
       tooltip: {
          ...
          confine: true
       }
   }
   

在使用echarts绘制图表时,由于内容区域比较小,hover到图表上后 tooltip 提示框如果内容比较多,自适应会就出现问题,导致提示框有一部分没有显示出来。

就像这样

image.png

设置后

image.png