-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
waiting for maintainerTriage or intervention needed from a maintainerTriage or intervention needed from a maintainer
Description
Describe the bug / 问题描述
https://g2.antv.antgroup.com/examples/general/cell/#cell-threshold
import { Chart } from '@antv/g2';
const chart = new Chart({
container: 'container',
width: 900,
height: 340,
});
chart
.cell()
.data({
type: 'fetch',
value:
'https://gw.alipayobjects.com/os/bmw-prod/89c20fe8-0c6f-46c8-b36b-4cb653dba8ed.json',
transform: [{ type: 'map', callback: (d) => ({ salary: d }) }],
})
.scale('color', {
type: 'threshold',
domain: [10000, 100000],
range: ['#eee', 'pink', 'red'],
})
.encode('y', (_, i) => (i % 5) + 1)
.encode('x', (_, i) => ((i / 5) | 0) + 1)
.encode('color', 'salary')
.style('stroke', '#000')
.style('inset', 2)
.animate('enter', { type: 'fadeIn' });
chart.render();
这样配置 scale 后,legend 往左拖动改变阈值区间,再往右拖动还原阈值区间,图形不会复原
.scale('color', {
type: 'threshold',
domain: [10000, 100000],
range: ['#eee', 'pink', 'red'],
})
Version / 版本
🆕 5.x
Metadata
Metadata
Assignees
Labels
waiting for maintainerTriage or intervention needed from a maintainerTriage or intervention needed from a maintainer