antvis / antvis/G2

聚合热力图在拖动图例范围的时候,x、y轴的缩略轴会出现undefined

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

Description

### 问题描述

当我拖动热力的范围图例,如果这个范围没有数据,则x、y轴都会变成undefined

### 重现链接

https://g2.antv.antgroup.com/zh/examples/general/cell/#cell-aggregated

### 重现步骤

代码
/**
* A recreation of this demo: https://vega.github.io/vega-lite/examples/rect_heatmap_weather.html
*/
import { Chart } from '@antv/g2';

const chart = new Chart({
container: 'container',
height: 300,
});

const data = [
{
"date": "2012-01-01T00:00:00.000Z",
"precipitation": 0,
"temp_max": 200,
"temp_min": 5,
"wind": 4.7,
"weather": "drizzle"
},
{
"date": "2012-01-02T00:00:00.000Z",
"precipitation": 10.9,
"temp_max": 10,
"temp_min": 2.8,
"wind": 4.5,
"weather": "rain"
},
{
"date": "2012-01-03T00:00:00.000Z",
"precipitation": 0.8,
"temp_max": 2,
"temp_min": 7.2,
"wind": 2.3,
"weather": "rain"
},
{
"date": "2012-01-05T00:00:00.000Z",
"precipitation": 1.3,
"temp_max": 8.9,
"temp_min": 2.8,
"wind": 6.1,
"weather": "rain"
},
{
"date": "2012-01-06T00:00:00.000Z",
"precipitation": 2.5,
"temp_max": 4.4,
"temp_min": 2.2,
"wind": 2.2,
"weather": "rain"
},
{
"date": "2012-01-07T00:00:00.000Z",
"precipitation": 0,
"temp_max": 7.2,
"temp_min": 2.8,
"wind": 2.3,
"weather": "rain"
},
{
"date": "2012-01-08T00:00:00.000Z",
"precipitation": 0,
"temp_max": 10,
"temp_min": 2.8,
"wind": 2,
"weather": "sun"
},
]

chart
.cell()
.data(data)
// .transform({ type: 'group', color: 'max' })
.encode('x', 'date')
.encode('y', 'weather')
.encode('color', 'temp_max')
.slider('x')
.slider('y')
.style('inset', 0.5)
.scale('color', { palette: 'gnBu' })
.animate('enter', { type: 'fadeIn' });

chart.render();

### 预期行为

预期不应该是undefined,可以为空或者 0

### 平台

- 操作系统: [macOS, Windows, Linux, React Native ...]
- 网页浏览器: [Google Chrome, Safari, Firefox]

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

image

### 补充说明(可选)

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by running the linked aggregated cell example with the provided TypeScript reproduction, then drag the heatmap range until it contains no data. Trace the x- and y-axis thumbnail updates during that interaction; done means empty ranges no longer render as undefined, using an empty value or 0 instead.

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.