Skip to content
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(axis): add axisAreaClear action. close #18446 #19232

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

CindyCUI423
Copy link

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

This PR adds and registers axisAreaClear action so that user can clear the axis range selection by calling the dispatchAction().

Fixed issues

[Feature] Clear axis range selection by action in parallel coordinates plot #18446

Details

Before: What was the problem?

There is no action available to clear the axis range selection in parallel coordinates plot. The only option is to click on an axis, but it would be helpful to clear the axis range selection by dispatching an action.

After: How does it behave after the fixing?

Now, dispatchAction( { type: 'axisAreaClear'} ) will clear the axis selection range on all axes.
Additionally, dispatchAction( { type: 'axisAreaClear', axes: ['x', 'y'] } ) will clear the axis selection range on the axes named 'x' and 'y' (the name as defined in the option.parallelAxis[i].name property).

No problems have been found with dispatchAction( { type: 'axisAreaClear'} ) so far, but a bug was found when testing { type: 'axisAreaClear', axes: ['x', 'y'] }.
For example, in the image below, if I only want to clear the selection range on the first axis by dispatchAction(), the selection range on the second axis is still there but the transparency is gone.
demo
Would appreciate it if anyone can tell me how to fix it.

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

  • Please squash the commits into a single one when merging.

Other information

@echarts-bot
Copy link

echarts-bot bot commented Oct 22, 2023

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the PR: awaiting doc label.

@github-actions
Copy link
Contributor

The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-19232@45fab44

Copy link
Contributor

@Ovilia Ovilia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the changes under dist and fix the lint problems as the bot suggests. Please also add test cases for this.

@CindyCUI423
Copy link
Author

Hi @Ovilia, I've fixed problems and a test case has been added as required. Please take a look, thank you : )

@CindyCUI423
Copy link
Author

And it seems that the project is now having problems with transparency disappearing. I get this problem when interacting with the examples on the website: https://echarts.apache.org/examples/en/editor.html?c=parallel-simple. So the problem described in detail should not be caused by my changes.

intervals: ParallelAxisInterval[]
parallelAxisId?: string;
intervals?: ParallelAxisInterval[];
axes?: string[]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is axisName of every axis, it should be named to be axisNames.

event: 'axisAreaSelected'
// update: 'updateVisual'
event: 'axisAreaSelected',
update: 'updateVisual'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why update: 'updateVisual' should be uncommented? I don't know why it's originally commented.

* Register the clear action
*/
registers.registerAction(clearActionInfo, function (payload: ParallelAxisAreaSelectPayload, ecModel: GlobalModel) {
if (payload.axes && payload.axes.length) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking if (payload.axes) should be enough.

registers.registerAction(clearActionInfo, function (payload: ParallelAxisAreaSelectPayload, ecModel: GlobalModel) {
if (payload.axes && payload.axes.length) {
// clear specific axes/axis by name
payload.axes.forEach(axisName => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the forEach in zrUtil to make it compatible for more devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants