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
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Chart's interaction enhancement tool for G2(Please use a version greater than 3.0.1).
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>
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'
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();
;
m install
m run dev
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.