G2Plot 是一套简单、易用、并具备一定扩展能力和组合能力的统计图表库,基于图形语法理论搭建而成,”G2Plot”中的 G2 即意指图形语法 (the Gramma of Graphics),同时也致敬了 ggplot2。
image.png
首页: https://antv-g2plot.gitee.io/zh/

快速上手

  1. <template>
  2. <div class="app-container">
  3. <div id="container"></div>
  4. </div>
  5. </template>
  6. <script>
  7. import { Line } from "@antv/g2plot";
  8. export default {
  9. data() {
  10. return {};
  11. },
  12. mounted() {
  13. const data = [
  14. { year: "1991", value: 3 },
  15. { year: "1992", value: 4 },
  16. { year: "1993", value: 3.5 },
  17. { year: "1994", value: 5 },
  18. { year: "1995", value: 4.9 },
  19. { year: "1996", value: 6 },
  20. { year: "1997", value: 7 },
  21. { year: "1998", value: 9 },
  22. { year: "1999", value: 13 },
  23. ];
  24. const line = new Line("container", {
  25. data,
  26. xField: "year",
  27. yField: "value",
  28. });
  29. line.render();
  30. },
  31. methods: {},
  32. };
  33. </script>