G2Plot 是一套简单、易用、并具备一定扩展能力和组合能力的统计图表库,基于图形语法理论搭建而成,”G2Plot”中的 G2 即意指图形语法 (the Gramma of Graphics),同时也致敬了 ggplot2。
首页: https://antv-g2plot.gitee.io/zh/
快速上手
<template>
<div class="app-container">
<div id="container"></div>
</div>
</template>
<script>
import { Line } from "@antv/g2plot";
export default {
data() {
return {};
},
mounted() {
const data = [
{ year: "1991", value: 3 },
{ year: "1992", value: 4 },
{ year: "1993", value: 3.5 },
{ year: "1994", value: 5 },
{ year: "1995", value: 4.9 },
{ year: "1996", value: 6 },
{ year: "1997", value: 7 },
{ year: "1998", value: 9 },
{ year: "1999", value: 13 },
];
const line = new Line("container", {
data,
xField: "year",
yField: "value",
});
line.render();
},
methods: {},
};
</script>