Echart.js图表未显示工具提示

3

我将使用Echart.js库。

var echartLine = echarts.init(document.getElementById('myChart'), theme);

在echart选项中,我添加了:

tooltip: {
                    show: true,
                    showContent: true,
                    alwaysShowContent: true,
                    triggerOn: 'mousemove',
                    trigger: 'axis',
                    axisPointer:
                        {
                            label: {
                                show: true,
                            }
                        }

                }, 

工具提示未显示。图像在下面。 在此输入图片描述


这是因为它在canvas元素中。我尝试将其添加到div中,但它无法渲染图表。有人知道为什么吗? - aleks.ru
4个回答

2
将选项触发器:'axis'更改为触发器:'item',它应该可以完美运行。

2
对于访问者:不要使用canvas作为容器,而是用divinit你的echarts,这样工具提示就会显示出来。

1

我的错误在于我把“tooltip”对象放入了“series”对象中。不要像我一样这样做。把这些对象放在附近。


Супер, спасибо! - Eugene Barsky

0
在我的情况下,当我将axisPointer.axis选项添加为“x”时,它可以正常工作,像这样:
tooltip: {
    trigger: "axis",
    axisPointer: {
      type: "shadow",
      axis: "x"
    }
  }

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接