antv g6 tooltip显示位置不对

蚂蚁金服图表工具antv G6在使用过程中不知道为什么tooltip显示的位置跟节点相差距离好大

this.graph = new G6.Graph({
        container: 'topology',
        height: this.height,
        width: this.width,
        modes: {
          default: [{
            type: 'tooltip',
            offset: 10,
            formatText(model) {
              const text = 'label: ' + model.label
              return text
            }
          }],
          layout: {
            type: 'grid',
            begin: [20, 20],
            preventOverlap: true,
            preventOverlapPadding: 20,
            nodeSize: 30
          }
        },
        defaultNode: {
          type: 'circle',
          size: [50, 50],
          labelCfg: {
            position: 'bottom'
          }
        },
        defaultEdge: {
          size: 2,
          color: '#DCDFE6'
        }
      })
      // this.graph.data({ nodes: this.nodes, edges: this.edges })
      this.graph.data({ nodes: [{ id: '0000', label: 'testSession', x: 300, y: 300, img: appNode }], edges: [] })
      this.graph.render()

B3C0F8D3-12D4-4c03-B5D7-1E658B96B48B.png

官网上面的显示倒是正常的,不知道为什么到我本地相差这么多

阅读 9.4k
2 个回答
新手上路,请多包涵

设置.g6-tooltip父元素position:relative;

我也遇到这个问题了,请问楼主解决了嘛?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题