1

我目前面临以下问题:我创建了一个简单的折线图并用示例数据填充它。但是工具提示没有出现。

我已经尝试在 ECharts 网站上使用我的配置,并且工具提示正在运行。

option = {
            title: {
              text: 'Baum'
            },
            tooltip: {
              trigger: 'item',
              show: true,
              showContent: true,
              alwaysShowContent: true,
              triggerOn: 'mousemove',
              axisPointer:
                  {
                    label: {
                      show: true,
                    }
                  }
            },
            legend: {
              data: ['lain', 'lain2']
            },
            xAxis:{
              type: 'category',
              data: ['1h', '2h', '3h', '4h', '5h', '6h', '7h', '8h', '9', '10'],
              boundaryGap: false,
            },
            yAxis: {
              type: 'value'
            },
            series: [
              {
                name: 'lain',
                type: 'line',
                showSymbol: true,
                data: [100,199,200,287,345,456,567,600,700,800],
                smooth: true
              },
              {
                name: 'lain2',
                type: 'line',
                showSymbol: true,
                data: [111,158,231,296,374,495,596, 650,750,879],
                smooth: true
              }
            ],
            animationDuration: 2000
          }
}

在 vue 中是这样实现的:

<v-chart :options="option"></v-chart>

图表本身中的数据正确显示。

提前谢谢。

4

1 回答 1

1

我找到了解决方案。

工具提示模块的导入必须显式导入。

import 'echarts/lib/component/tooltip'

通过此导入,它可以正常工作。

于 2020-11-05T19:04:04.540 回答