antvis/g2-brush

Name: g2-brush

Owner: AntV team

Description: Select a one-, two-dimensional or irregular region using the mouse.

Created: 2017-12-11 10:22:09.0

Updated: 2018-05-22 11:38:55.0

Pushed: 2017-12-15 05:31:21.0

Homepage: https://antvis.github.io/g2-brush/demos/#

Size: 3046

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

g2-brush

npm package NPM downloads Percentage of issues still open

Chart's interaction enhancement tool for G2(Please use a version greater than 3.0.1).

Install
m install @antv/g2-brush

or use cdn:

ipt src="https://gw.alipayobjects.com/os/antv/assets/g2-brush/0.0.2/g2-brush.js"></script>
Usage

First of all, the brush instance must be created after the chart be rendered.

rt Brush from '@antv/g2-brush';
..
t.render();

Brush({
nvas: chart.get('canvas'), // must be set
art, // if you want to filter data by default, please set the chart
pe: 'X', // set the brush type, default value is 'XY'

Example

online demos: https://antvis.github.io/g2-brush/demos/#

tJSON('./data/top2000.json', data => {
nst ds = new DataSet();
nst dv = ds.createView('test')
.source(data)
.transform({
  as: [ 'count' ],
  groupBy: [ 'release' ],
  operations: [ 'count' ],
  type: 'aggregate'
});

nst chart = new G2.Chart({
container: 'canvas',
forceFit: true,
height: window.innerHeight
;
art.source(dv);
art.scale({
count: {
  alias: 'top2000 ????'
},
release: {
  tickInterval: 5,
  alias: '??????'
}
;
art.interval()
.position('release*count')
.color('#e50000');

art.render();

w Brush({
canvas: chart.get('canvas'),
chart,
type: 'X',
onBrushstart() {
  chart.hideTooltip();
},
onBrushmove() {
  chart.hideTooltip();
}
;
art.on('plotdblclick', () => {
chart.get('options').filters = {};
chart.repaint();
;

API

API DOCS

Development
m install

m run dev
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.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.