-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(region-filter): add geometry life circle, after draw animate #2879
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,61 @@ | ||
import { Chart } from '../../src'; | ||
import { createDiv } from '../util/dom'; | ||
import { delay } from '../util/delay'; | ||
|
||
describe('2851', () => { | ||
it('2851', async () => { | ||
const data = [ | ||
{ year: '1951 年', sales: 280 }, | ||
{ year: '1952 年', sales: 52 }, | ||
{ year: '1956 年', sales: 61 }, | ||
{ year: '1957 年', sales: 145 }, | ||
{ year: '1958 年', sales: 48 }, | ||
{ year: '1959 年', sales: 38 }, | ||
{ year: '1960 年', sales: 38 }, | ||
{ year: '1962 年', sales: 38 }, | ||
]; | ||
|
||
const chart = new Chart({ | ||
container: createDiv(), | ||
width: 400, | ||
height: 300, | ||
autoFit: true, | ||
}); | ||
|
||
chart.animate(false); | ||
chart.data(data); | ||
|
||
chart | ||
.line() | ||
.position('year*sales'); | ||
|
||
chart.annotation().line({ | ||
top: true, | ||
start: ['min', 100], | ||
end: ['max', 100], | ||
style: { | ||
stroke: 'red', | ||
lineDash: [2, 2], | ||
}, | ||
}); | ||
|
||
chart.annotation().regionFilter({ | ||
top: true, | ||
start: ['min', 100], | ||
end: ['max', 0], | ||
color: '#f5222d' | ||
}); | ||
|
||
chart.render(); | ||
// 防止事件内存泄露 | ||
// @ts-ignore | ||
expect(chart.geometries[0]._events).toEqual({}); | ||
|
||
chart.changeSize(500, 400); | ||
|
||
// @ts-ignore | ||
expect(chart.geometries[0]._events).toEqual({}); | ||
|
||
// regionFilter 不知道怎么去断言! | ||
}) | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { reduce } from '@antv/util'; | ||
|
||
export function omit(obj: any, keys: string[]): object { | ||
// @ts-ignore | ||
return reduce(obj, (r: any, curr: any, key: string) => { | ||
if (!keys.includes(key)) { | ||
r[key] = curr; | ||
} | ||
return r; | ||
}, {}); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是 element 没执行完一次动画就发射了啊。
这个是不是应该是在 view 层发射动画结束的事件更合适?我记得 G 里面是有几个标识位的:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我想过了,不冲突。
view 里面做动画是否结束,需要看他的 geometry 还是子 view 的 geometry,太难了啊,还没有想清楚,如果要做 view 上的,肯定是组合他下面的 geometry 的动画结束事件,然后发送一个 view 的动画结束事件。
所以现在 geometry 上做掉,解决一部分问题。