-
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(interaction): add elementSelect, elementSelectByX, elementSelect… #4219
Merged
Conversation
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
hustcc
approved these changes
Oct 25, 2022
不建议改 select
发自我的 iPad
…------------------ Original ------------------
From: MiniPear ***@***.***>
Date: Tue,Oct 25,2022 5:48 PM
To: antvis/G2 ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [antvis/G2] feat(interaction): add elementSelect, elementSelectByX, elementSelect… (PR #4219)
添加 ElementSelect
4.0 叫 ElementSelected,这个命名是有问题的:ElementActive 不叫 ElementActived。所以改成 ElementSelect,同时增加了 ElementSelectByX 和 ElementSelectByColor。
ElementSelect
ElementSelectByX
ElementSelectByColor
多选
export function alphabetIntervalSelect(): G2Spec { return { type: 'interval', padding: 0, data: { type: 'fetch', value: 'data/alphabet.csv', }, axis: false, legend: false, encode: { x: 'letter', y: 'frequency', color: 'steelblue', }, interaction: [ { type: 'elementSelect', selectedFill: 'red', unselectedOpacity: 0.6 }, ], }; }
单选
export function alphabetIntervalSelectSingle(): G2Spec { return { type: 'interval', padding: 0, transform: [{ type: 'sortX', by: 'y', reverse: true }], data: { type: 'fetch', value: 'data/alphabet.csv', }, axis: false, legend: false, encode: { x: 'letter', y: 'frequency', color: 'steelblue', }, interaction: [ { type: 'elementSelect', selectedFill: 'red', unselectedOpacity: 0.6, single: true, }, ], }; }
By X
export function stateAgesIntervalSelectByX(): G2Spec { return { type: 'interval', padding: 0, transform: [ { type: 'sortX', by: 'y', reverse: true, reducer: 'sum', slice: 6 }, { type: 'dodgeX' }, ], data: { type: 'fetch', value: 'data/stateages.csv', }, axis: false, legend: false, encode: { x: 'state', y: 'population', color: 'age', }, interaction: [ { type: 'elementSelectByX', selectedFill: 'red', unselectedOpacity: 0.6, }, ], }; }
By Color
(d.state === 'CA' ? 'red' : undefined), selectedStroke: '#000', selectedStrokeWidth: 1, unselectedOpacity: 0.6, linkFillOpacity: 0.5, single: true, }, ], }; }" dir="auto">export function stateAgesIntervalSelectByColorSingle(): G2Spec { return { type: 'interval', padding: 0, axis: false, legend: false, width: 800, transform: [ { type: 'stackY' }, { type: 'sortX', by: 'y', reverse: true, slice: 5 }, ], data: { type: 'fetch', value: 'data/stateages.csv', format: 'csv', }, encode: { x: 'state', y: 'population', color: 'age', }, scale: { x: { paddingInner: 0.2 }, }, interaction: [ { type: 'elementSelectByColor', link: true, linkFill: (d) => (d.state === 'CA' ? 'red' : undefined), selectedStroke: '#000', selectedStrokeWidth: 1, unselectedOpacity: 0.6, linkFillOpacity: 0.5, single: true, }, ], }; }
You can view, comment on, or merge this pull request online at:
#4219
Commit Summary
f91e55b feat(interaction): add elementSelect, elementSelectByX, elementSelectByColor
File Changes
(37 files)
A __tests__/integration/interactions/alphabet-interval-select-single.ts (36)
A __tests__/integration/interactions/alphabet-interval-select.ts (42)
M __tests__/integration/interactions/index.ts (5)
A __tests__/integration/interactions/stateages-interval-select-by-color-single.ts (60)
A __tests__/integration/interactions/stateages-interval-select-by-color.ts (53)
A __tests__/integration/interactions/stateages-interval-select-by-x.ts (38)
A __tests__/integration/snapshots/alphabet-interval-select-single/step0.png (0)
A __tests__/integration/snapshots/alphabet-interval-select-single/step1.png (0)
A __tests__/integration/snapshots/alphabet-interval-select-single/step2.png (0)
A __tests__/integration/snapshots/alphabet-interval-select/step0.png (0)
A __tests__/integration/snapshots/alphabet-interval-select/step1.png (0)
A __tests__/integration/snapshots/alphabet-interval-select/step2.png (0)
A __tests__/integration/snapshots/alphabet-interval-select/step3.png (0)
A __tests__/integration/snapshots/alphabet-interval-select/step4.png (0)
A __tests__/integration/snapshots/alphabet-interval-select/step5.png (0)
A __tests__/integration/snapshots/state-ages-interval-select-by-color-single/step0.png (0)
A __tests__/integration/snapshots/state-ages-interval-select-by-color-single/step1.png (0)
A __tests__/integration/snapshots/state-ages-interval-select-by-color-single/step2.png (0)
A __tests__/integration/snapshots/state-ages-interval-select-by-color-single/step3.png (0)
A __tests__/integration/snapshots/state-ages-interval-select-by-color-single/step4.png (0)
A __tests__/integration/snapshots/state-ages-interval-select-by-color/step0.png (0)
A __tests__/integration/snapshots/state-ages-interval-select-by-color/step1.png (0)
A __tests__/integration/snapshots/state-ages-interval-select-by-color/step2.png (0)
A __tests__/integration/snapshots/state-ages-interval-select-by-color/step3.png (0)
A __tests__/integration/snapshots/state-ages-interval-select-by-x/step0.png (0)
M __tests__/unit/stdlib/index.spec.ts (6)
M src/interaction/index.ts (5)
M src/interaction/native/elementActive.ts (2)
M src/interaction/native/elementActiveByColor.ts (3)
M src/interaction/native/elementActiveByX.ts (7)
A src/interaction/native/elementSelect.ts (113)
A src/interaction/native/elementSelectByColor.ts (19)
A src/interaction/native/elementSelectByX.ts (19)
M src/interaction/native/utils.ts (27)
M src/runtime/plot.ts (4)
M src/spec/interaction.ts (24)
M src/stdlib/index.ts (6)
Patch Links:
https://github.com/antvis/G2/pull/4219.patch
https://github.com/antvis/G2/pull/4219.diff
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
嗷,没有仔细看改名的事情~
综合,如无强烈缘由,不改名。可以再看下是否有强烈缘由,需要改名。 |
hustcc
pushed a commit
that referenced
this pull request
May 16, 2023
hustcc
pushed a commit
that referenced
this pull request
May 16, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
添加 ElementSelect
4.0 叫 ElementSelected,这个命名是有问题的:ElementActive 不叫 ElementActived。所以改成 ElementSelect,同时增加了 ElementSelectByX 和 ElementSelectByColor。
多选
单选
By X
By Color