antvis / antvis/G2

【G2 V5】双折线共用坐标轴时,如果一个折线的字段无值,会导致所有折线都不能正常展示

Open
#6,245 1 comment 0 reactions 0 assignees View on GitHub
v5
Dominant language
TypeScript
Stars
12.6k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

### 问题描述

双折线共用坐标轴时,如果一个折线的字段无值,会导致所有折线都不能正常展示,而且坐标轴的排列变得很乱
![image](https://github.com/antvis/G2/assets/52809015/29d4491c-397e-4b07-81e8-150bcbd4ebb8)

### 重现链接

https://codesandbox.io/p/sandbox/festive-wood-4skhqp?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522clwkj02bp00063b6j97g5uchc%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522clwkj02bp00023b6j1vx1hw9c%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522clwkj02bp00033b6jvkrxy87f%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522clwkj02bp00053b6jjpb3cjb2%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522clwkj02bp00023b6j1vx1hw9c%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clwkj02bo00013b6jc8u1d7sm%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522filepath%2522%253A%2522%252Fsrc%252Findex.js%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522id%2522%253A%2522clwkj02bp00023b6j1vx1hw9c%2522%252C%2522activeTabId%2522%253A%2522clwkj02bo00013b6jc8u1d7sm%2522%257D%252C%2522clwkj02bp00053b6jjpb3cjb2%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522clwkj02bp00043b6jxqr3ahfk%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522path%2522%253A%2522%252F%2522%257D%255D%252C%2522id%2522%253A%2522clwkj02bp00053b6jjpb3cjb2%2522%252C%2522activeTabId%2522%253A%2522clwkj02bp00043b6jxqr3ahfk%2522%257D%252C%2522clwkj02bp00033b6jvkrxy87f%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522clwkj02bp00033b6jvkrxy87f%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15%257D

### 重现步骤

满足两个条件:
1、图表中的两条折线共用一个坐标轴,即都没有设置independent: true
2、数据中其中一条折线的字段,不存在任何值(备注:只要有一个值页面展示都是正常的)

### 预期行为

坐标轴的刻度最起码要展示正常

### 平台

- 操作系统: [macOS]
- 网页浏览器: [Google Chrome]

### 屏幕截图或视频(可选)

![image](https://github.com/antvis/G2/assets/52809015/1283298b-cbb8-47f9-a6da-843e9f8a6626)

### 补充说明(可选)

场景就是,我们需要展示环比上月和同比去年的数据,但是去年并没有数据,所以导致这个字段值无值,而且把值设置为0也是不合适的,因为去年没有数据
![image](https://github.com/antvis/G2/assets/52809015/8145b713-da5f-44a6-aa25-e64f6488df3f)

Contributor guide

Open the contributing guide

Research direction

Start with the linked CodeSandbox reproduction and its src/index.js entry point, then reproduce the case where two lines share an axis and one field has no values. Trace the shared-axis rendering behavior in the repository and add a regression test if the relevant test location is identified. Done means both lines remain usable and the axis tick layout displays normally when one field is entirely empty.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.