npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@antv/g2

v5.2.10

Published

the Grammar of Graphics in Javascript

Downloads

615,955

Readme

English | 简体中文

简洁的渐进式可视化语法,用于构建仪表盘、数据探索以及数据讲故事。

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
$ yarn add @antv/g2

成功安装之后,可以通过 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',
});

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

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

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

🌍 生态

📮 参与贡献

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

📄 许可证

MIT@AntV.