GithubHelp home page GithubHelp logo

eddings / g2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antvis/g2

0.0 0.0 0.0 180.79 MB

📊 A concise and progressive visualization grammar.

Home Page: https://g2.antv.antgroup.com

License: MIT License

Shell 0.01% JavaScript 2.37% TypeScript 81.54% CSS 2.14% HTML 13.82% Less 0.11%

g2's Introduction

English | 简体中文

G2 5.0

简洁的渐进式可视化语法

介绍案例教程API

Build Status Coverage Status npm Version npm Download npm License

examples

G2 起源于 Leland Wilkinson 的图形语法:《The Grammar of Graphics》,但又不止于图形语法。

✨ 特色

  • 渐进式语法:结合工业和学术实践,实现图形语法、动画语法和交互语法。
  • 丰富的标记:内置 10+ 基础标记,8+ 高阶标记。
  • 高可扩展性:提供统一机制扩展所有可视化组件。
  • 个性化风格:支持手绘、圆角、纹理等风格。
  • 多环境渲染:支持 Canvas、SVG 以及 WebGL,和 Node.js 服务端渲染。

🔨 开始使用

可以通过 NPM 或 Yarn 等包管理器来安装。

$ npm install @antv/g2@next
$ yarn add @antv/g2@next

成功安装之后,可以通过 import 导入 Chart 对象。

<div id="container"></div>
import { Chart } from '@antv/g2';

// 准备数据
const data = [
  { genre: 'Sports', sold: 275 },
  { genre: 'Strategy', sold: 115 },
  { genre: 'Action', sold: 120 },
  { genre: 'Shooter', sold: 350 },
  { genre: 'Other', sold: 150 },
];

// 初始化图表实例
const chart = new Chart({
  container: 'container',
  theme: 'classic',
});

// 声明可视化
chart
  .interval() // 创建一个 Interval 标记
  .data(data) // 绑定数据
  .encode('x', 'genre') // 编码 x 通道
  .encode('y', 'sold'); // 编码 y 通道

// 渲染可视化
chart.render();

如果一切顺利,你可以得到下面的柱状图!

example

📮 参与贡献

  • 问题: 报告 bug 或者提出需求
  • 贡献指南:参与建设 G2
  • 讨论:在 Github 上或者钉钉群里面讨论(30233731, 35686967, 44788198)

code

📄 许可证

MIT@AntV.

g2's People

Contributors

aarebecca avatar chenkun1997 avatar cuiyansong avatar humandetail avatar hustcc avatar ixuxinyue avatar lxfu1 avatar neoddish avatar pearmini avatar pepper-nice avatar rainy-25ghz avatar shield2018 avatar timgates42 avatar visiky avatar wuhaiyang avatar xiaoiver avatar xingwanying avatar xujingli avatar yujiahan2018 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.