同步操作将从 antv/G2 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
English | 简体中文
Website • Tutorial Docs • Blog • G2Plot
G2 is a visualization grammar, a data-driven visual language with a high level of usability and scalability. It provides a set of grammars, takes users beyond a limited set of charts to an almost unlimited world of graphical forms. With G2, you can describe the visual appearance and interactive behavior of a visualization just by one statement, and generate web-based views using Canvas or SVG.
$ npm install @antv/g2
Before drawing we need to prepare a DOM container for G2:
<div id="c1"></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 },
];
// Step 1: Create a Chart instance.
const chart = new Chart({
container: 'c1', // Specify chart container ID
width: 600, // Specify chart width
height: 300, // Specify chart height
});
// Step 2: Load the data.
chart.data(data);
// Step 3: Declare the grammar of graphics, draw column chart.
chart.interval().position('genre*sold');
// Step 4: Render chart.
chart.render();
# Install dependencies
$ npm install
# Run test cases
$ npm run test
# Open electron to run test cases and listen to file changes
$ npm run test-live
# Run CI
$ npm run ci
# Run website
$ npm start
You can also use G2Plot which is an interactive and responsive charting library based on G2. You can easily make superior statistical plots through a few lines of code.
Please let us know how can we help. Do check out issues for bug reports or suggestions first.
To become a contributor, please follow our contributing guide.
DingTalk Group: 30233731
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。