Replies: 1 comment
-
是的,API 是语法糖,最终生成配置项。 // 初始化图表实例
const chart = new G2.Chart({ /**/ });
// 声明可视化
chart.options({
type: 'interval', // 创建一个 Interval 标记
data: [
// 绑定数据
{ genre: 'Sports', sold: 275 },
{ genre: 'Strategy', sold: 115 },
{ genre: 'Action', sold: 120 },
{ genre: 'Shooter', sold: 350 },
{ genre: 'Other', sold: 150 },
],
encode: {
x: 'genre', // 编码 x 通道
y: 'sold', // 编码 y 通道
},
});
// 渲染可视化
chart.render(); 具体文档参考:https://g2.antv.antgroup.com/manual/extra-topics/experimental-spec-api |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
换个角度,可以直接传入配置项生成图表吗?【如echarts】
有些好奇。
Beta Was this translation helpful? Give feedback.
All reactions