Skip to content

Vue3项目中使用折线图出现tooltip不显示 #14342

@LinsRock

Description

@LinsRock

Version

5.0.2

Reproduction link

https://codesandbox.io/s/magical-smoke-vyigt?file=/src/components/chart.vue

Steps to reproduce

  1. 当我将tooltip设置成一个空对象时,tooltip显示
  2. 当我给tooltip设置值时,tooltip不显示
  3. 但我将相同的options复制到官方示例中,又可以正常显示tooltip,不确定是不是Vue3环境的问题
options = {
   grid: { left: 10, bottom: 20, top: 10, right: 30 },
    xAxis: {
      type: 'category',
      boundaryGap: false,
      data: [11, 12, 13, 14, 15, 16, 17]
    },
    yAxis: {
      type: 'value',
      position: 'right'
      // min: 213,
      // max: 416
    },
    // tooltip: {},
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'cross',
        animation: false,
        label: {
          backgroundColor: '#ccc',
          borderColor: '#aaa',
          borderWidth: 1,
          shadowBlur: 0,
          shadowOffsetX: 0,
          shadowOffsetY: 0,
          color: '#222'
        }
      },
      formatter: function(params: any) {
        console.log(params)
        return params.name   ':'   params.value;
      }
    },
    series: [
      {
        type: 'line',
        symbolSize: 6,
        // showSymbol: false,
        // hoverAnimation: false,
        lineStyle: {
          color: ' #76A9FF'
        },
        areaStyle: {
          color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
            {
              offset: 0,
              color: 'rgba(159, 195, 255, 0.61)'
            },
            {
              offset: 1,
              color: 'rgba(157, 194, 255, 0)'
            }
          ])
        },
        data: [312.23, 366.21, 355.21, 310.2, 370.11, 300, 360.99]
      }
    ]
}

What is expected?

期望鼠标hover时可以显示tooltip

What is actually happening?

当我给tooltip设置值时,tooltip不显示

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions