Skip to content
master
Go to file
Code

Latest commit

* feat(transform): 添加获�元素旋转矩阵的 util 方法

- [x] test cases passed

* refactor: move label/pie file into label/pie folder

* refactor: 将 label items 的调整从碰撞检测算法抽离出 & 调整 labels 容器的范围大�

[x] test cases passed

* feat(graphics-util): 添加旋转场景下的 intersect 检测方法

* feat(label-layout): add hide-overlap label layout

- [x] with test cases
- [x] test cases passed

* feat: 添加 label 背景�置 & 修� offset 调整对于 content group 失效

- [x] demo
- [ ] docs of how to config label background
- [ ] add test cases

* fix: 修改 cr 建议

1. label background �置��统一,图形属性相关的统一在 style 中
2. hide-overlap 直接设置 visible: false, �少循环

* fix: 修改 cr 建议

1. label background �置��统一,图形属性相关的统一在 style 中
2. hide-overlap 直接设置 visible: false, �少循环
3. rotate 方法,直接调用 getRotateMatrix 获�旋转矩阵

* fix: 修改 cr 建议

* refactor(detect-overlap): 优化矩形碰撞检测算法

- [x] 基于 分离轴定律 判断两个旋转矩形是�碰撞
- [x] 优化 hiver-overlap 标签布局算法
- [x] 优化获�标签背景信�的方法,返回关键点和旋转角度��

* feat(perf): 添加 hide-overlap 算法的性能测试

为了��污染输出 & �少�必�的日常测试, 先 skip 掉, �续增加一个日常测试的匹� 和 性能测试的 script 作为区分

* refactor: 修改 cr 建议, 使用 matrix-util 的 dot 点积方法

* refactor: 将碰撞检测算法移动到 collision-detect 中

* feat(perf): 添加 600个 指标性能判断

Co-authored-by: xinming <xinming.lxj@antfin.com>
e52544d

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Sep 3, 2019

README.md

English | 简体中文

G2

A highly interactive data-driven visualization grammar for statistical charts.

CI Coverage Status NPM Package NPM Downloads Dependencies Percentage of issues still open PRs Welcome

Website • Tutorial Docs • Blog

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.

📺 Live Demos

✨ Features

  • 💯Stable grammar of graphics: enable to draw all kinds of charts by mapping data to graphics.
  • 🤩New grammar of interaction: interaction behaviors combined with Trigger and Action mechanisms are used to exploring data.
  • ðŸ¦?Advanced View module: with the ability to develop customized multi-dimension data analysis graphics.
  • 👬Dual-engine rendering: with the ability to switch Canvas and SVG freely.
  • 💄Visual components: interaction-oriented, elegant experience.
  • 🛡Fully embrace Typescript: Complete type definition files are provided.

📦 Installation

$ npm install @antv/g2

🔨 Getting Started

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();

⌨� Development

# 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

�� Releases

� How to Contribute

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.

You can’t perform that action at this time.