Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 线标注和滑动条同时存在,并且线标注的值超过数据最大值,滑动之后,线标注会消失 #6701

Open
2 of 10 tasks
JmoVxia opened this issue Mar 24, 2025 · 1 comment
Labels
bug 🐛 Something isn't working OSCP AntV Open Source Contribution Plan

Comments

@JmoVxia
Copy link

JmoVxia commented Mar 24, 2025

Describe the bug / 问题描述

Image

import { Chart } from '@antv/g2';

const chart = new Chart({
  container: 'container',
  autoFit: true,
});

chart
.data([
  { Day: 1, Value: 54.8 },
  { Day: 2, Value: 112.1 },
  { Day: 3, Value: 63.6 },
  { Day: 4, Value: 37.6 },
  { Day: 5, Value: 79.7 },
  { Day: 6, Value: 137.9 },
  { Day: 7, Value: 120.1 },
  { Day: 8, Value: 103.3 },
  { Day: 9, Value: 294.8 },
  { Day: 10, Value: 199.5 },
  { Day: 11, Value: 72.3 },
  { Day: 12, Value: 51.1 },
  { Day: 13, Value: 112.0 },
  { Day: 14, Value: 174.5 },
  { Day: 15, Value: 130.5 },
])
.axis('y', { title: false });

chart.interval()
  .encode('x', 'Day')
  .encode('y', 'Value')
  .scrollbar('x', {
    ratio: 0.5,
    values: [0, 1],
  })


chart
  .lineY()
  .data([300])
  .style('stroke', '#F4664A')
  .label({
    text: 'hazardous',
    position: 'left',
    textBaseline: 'bottom',
    fill: '#F4664A',
    background: true,
    backgroundFill: '#F4664A',
    backgroundOpacity: 0.25,
  })
  .scrollbar('x', false);

chart.render();

Reproduction link / 复现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

Version / 版本

🆕 5.x

OS / 操作系统

  • macOS
  • Windows
  • Linux
  • Others / 其他

Browser / 浏览器

  • Chrome
  • Edge
  • Firefox
  • Safari (Limited support / 有限支持)
  • IE (Nonsupport / 不支持)
  • Others / 其他
@JmoVxia JmoVxia added the waiting for maintainer Triage or intervention needed from a maintainer label Mar 24, 2025
@interstellarmt
Copy link
Contributor

看了一下应该是滚动之后图表的主区域高度计算没有算上text的高度,导致text被遮挡。
可以先配置一下图表上方呼吸范围的大小

{
     insetTop: 50
}

@interstellarmt interstellarmt added bug 🐛 Something isn't working and removed waiting for maintainer Triage or intervention needed from a maintainer labels Mar 24, 2025
@hustcc hustcc added the OSCP AntV Open Source Contribution Plan label Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working OSCP AntV Open Source Contribution Plan
Projects
None yet
Development

No branches or pull requests

3 participants