G2 icon indicating copy to clipboard operation
G2 copied to clipboard

Tooltip crosshairs 设置问题

Open visiky opened this issue 4 years ago • 4 comments

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://g2.antv.vision/en/examples/line/basic#base

Steps to reproduce

chart.tooltip({
  showCrosshairs: true, // 展示 Tooltip 辅助线
  shared: true,
  crosshairs: {
    type: 'xy',
    follow: true,
    text: (type, defaultContent, items) => {
      const tooltipCrosshairsText = { position: type === 'y' ? 'start' : 'end' };
      if (type === 'x') {
        const item = items[0];
        tooltipCrosshairsText['content'] = item ? item.title : defaultContent;
      } else {
        tooltipCrosshairsText['content'] = `${defaultContent.toFixed(2)}`;
      }
      return tooltipCrosshairsText;
    },
    textBackground: {
      padding: [4, 8],
      style: {}
    }
  }
});
Environment Info
g2 4.1.16
System -
Browser -

image

visiky avatar May 24 '21 06:05 visiky

什么问题?@visiky

hustcc avatar Oct 08 '21 11:10 hustcc

多组柱状图时 辅助线可以居中吗

dadazhouRenee avatar Nov 04 '21 06:11 dadazhouRenee

遇到同样的问题,这里 Y 轴的显示数值被遮挡了,另外还有个问题,能否设置 crosshairs 的辅助线 z-index ,让其始终置于顶层

Phinome avatar Jun 16 '22 09:06 Phinome

什么问题?@visiky

y 轴上有一个 2.55, 但实际数值并不是

visiky avatar Jun 23 '22 02:06 visiky

image

是不是已经修复了?

什么问题?@visiky

y 轴上有一个 2.55, 但实际数值并不是

hustcc avatar Dec 07 '22 05:12 hustcc