antvis/G2
The issue has been closed
facetRect 设置 coordinate({ type: 'polar' }) 失效 #5220
pearmini posted onGitHub
Discussed in https://github.com/antvis/G2/discussions/5219
- 版本:5.0.13
import { Chart } from '@antv/g2';
const data = [
{
type: '《山河圖》',
value: 1,
n: 64,
},
{
type: '《山河圖》',
value: 2,
n: 37,
},
{
type: '《山河圖》',
value: 3,
n: 29,
},
{
type: '《æ¸é€”有風》',
value: 1,
n: 58,
},
{
type: '《æ¸é€”有風》',
value: 2,
n: 38,
},
{
type: '《æ¸é€”有風》',
value: 3,
n: 25,
},
];
const chart = new Chart({
container: 'container',
autoFit: true,
theme: 'classic',
});
const facetchart = chart.facetRect().data(data).encode('x', 'type');
facetchart
.interval()
.coordinate({ type: 'polar' }) // 这里设置 polar
.encode('x', 'value')
.encode('y', 'n')
.encode('color', 'value')
.axis('y', false);
chart.render();