antvis/G2



The issue has been closed
【v5】散点图 size 绑定数据时,color 设置固定颜色无法作图 #4904
Deathsteps posted onGitHub
问题描述
只设置 size 通道,正常 <img width="1031" alt="image" src="https://user-images.githubusercontent.com/1549118/233817497-86fee576-d047-4fb8-af0d-556d079b8c80.png">
异常情况 <img width="1029" alt="image" src="https://user-images.githubusercontent.com/1549118/233817450-db7902fa-e692-420c-90e2-40e474163a4a.png">
期望结果
size 绑定数据时,color 可以设置某个固定颜色
如何重现
官方示例修改
import { Chart } from '@antv/g2';
const chart = new Chart({
container: 'container',
theme: 'classic',
2autoFit: true,
});
chart
.point()
.data({
type: 'fetch',
value:
'https://gw.alipayobjects.com/os/basement_prod/6b4aa721-b039-49b9-99d8-540b3f87d339.json',
})
.encode('x', 'height')
.encode('y', 'weight')
.encode('size', 'gender')
.encode('color', 'red');
chart.render();
额外信息
- G2 5.0.3