-
Notifications
You must be signed in to change notification settings - Fork 605
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(interaction): support config brush start enable * chore: v2.4.20 & changelog * docs: 添加一个定制的 brush 交互
- Loading branch information
Showing
11 changed files
with
288 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { Column } from '../../../src'; | ||
import { createDiv } from '../../utils/dom'; | ||
|
||
describe('Brush', () => { | ||
it('', () => { | ||
const data = [ | ||
{ | ||
name: 'London', | ||
月份: 'Jan.', | ||
月均降雨量: 18.9, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'Feb.', | ||
月均降雨量: 28.8, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'Mar.', | ||
月均降雨量: 39.3, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'Apr.', | ||
月均降雨量: 81.4, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'May', | ||
月均降雨量: 47, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'Jun.', | ||
月均降雨量: 20.3, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'Jul.', | ||
月均降雨量: 24, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'Aug.', | ||
月均降雨量: 35.6, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Jan.', | ||
月均降雨量: 12.4, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Feb.', | ||
月均降雨量: 23.2, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Mar.', | ||
月均降雨量: 34.5, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Apr.', | ||
月均降雨量: 99.7, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'May', | ||
月均降雨量: 52.6, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Jun.', | ||
月均降雨量: 35.5, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Jul.', | ||
月均降雨量: 37.4, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Aug.', | ||
月均降雨量: 42.4, | ||
}, | ||
]; | ||
|
||
const plot = new Column(createDiv(), { | ||
data, | ||
isGroup: true, | ||
xField: '月份', | ||
yField: '月均降雨量', | ||
seriesField: 'name', | ||
brush: { | ||
enabled: true, | ||
action: 'highlight', | ||
isStartEnable: (context) => { | ||
if (context.event.gEvent.originalEvent?.shiftKey) { | ||
return true; | ||
} | ||
return false; | ||
}, | ||
}, | ||
interactions: [{ type: 'element-selected' }], | ||
}); | ||
|
||
plot.render(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import { Column } from '@antv/g2plot'; | ||
|
||
describe('Brush', () => { | ||
it('', () => { | ||
const data = [ | ||
{ | ||
name: 'London', | ||
月份: 'Jan.', | ||
月均降雨量: 18.9, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'Feb.', | ||
月均降雨量: 28.8, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'Mar.', | ||
月均降雨量: 39.3, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'Apr.', | ||
月均降雨量: 81.4, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'May', | ||
月均降雨量: 47, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'Jun.', | ||
月均降雨量: 20.3, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'Jul.', | ||
月均降雨量: 24, | ||
}, | ||
{ | ||
name: 'London', | ||
月份: 'Aug.', | ||
月均降雨量: 35.6, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Jan.', | ||
月均降雨量: 12.4, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Feb.', | ||
月均降雨量: 23.2, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Mar.', | ||
月均降雨量: 34.5, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Apr.', | ||
月均降雨量: 99.7, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'May', | ||
月均降雨量: 52.6, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Jun.', | ||
月均降雨量: 35.5, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Jul.', | ||
月均降雨量: 37.4, | ||
}, | ||
{ | ||
name: 'Berlin', | ||
月份: 'Aug.', | ||
月均降雨量: 42.4, | ||
}, | ||
]; | ||
|
||
const plot = new Column('container', { | ||
data, | ||
isGroup: true, | ||
xField: '月份', | ||
yField: '月均降雨量', | ||
seriesField: 'name', | ||
brush: { | ||
enabled: true, | ||
action: 'highlight', | ||
isStartEnable: (context) => { | ||
// 按住 shift 键,才能开启交互 | ||
if (context.event.gEvent.originalEvent?.shiftKey) { | ||
return true; | ||
} | ||
return false; | ||
}, | ||
}, | ||
interactions: [{ type: 'element-selected' }], | ||
}); | ||
|
||
plot.render(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export const version = '2.4.19'; | ||
export const version = '2.4.20'; | ||
|
||
// G2 自定义能力透出 | ||
import * as G2 from '@antv/g2'; | ||
|
Oops, something went wrong.