G2Plot 漏斗图旋转180度教程:使用 transpose 属性
要将 G2Plot 漏斗图旋转 180 度,可以使用 G2Plot 的配置项 'transpose'。将 'transpose' 设置为 'true',即可将漏斗图旋转 180 度。
示例代码:
import { Funnel } from '@antv/g2plot';
const data = [
{ stage: '浏览网站', count: 1000 },
{ stage: '放入购物车', count: 800 },
{ stage: '生成订单', count: 600 },
{ stage: '支付订单', count: 400 },
{ stage: '完成交易', count: 200 },
];
const funnelPlot = new Funnel('container', {
data,
xField: 'count',
yField: 'stage',
transpose: true, // 将漏斗图旋转 180 度
});
funnelPlot.render();
运行以上代码,即可看到漏斗图被旋转 180 度。
原文地址: https://www.cveoy.top/t/topic/lVgj 著作权归作者所有。请勿转载和采集!