是否無法搭配使用 facetRect 和 coordinate('polar') #5219
Answered
by
pearmini
Dennishi0925
asked this question in
Q&A
-
您好: 我想搭配使用 facet 和 coordinate('polar') 這邊是單純用 coordinate('polar') 的 code
但如果搭配使用facet 和 coordinate('polar') 時
我多加了一句 感謝! |
Beta Was this translation helpful? Give feedback.
Answered by
pearmini
Jun 25, 2023
Replies: 1 comment 2 replies
-
正确的用法应该如下: 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(); 但是目前还是没有绘制出来,我得排查一下。 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
pearmini
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
正确的用法应该如下: