Skip to content

fix(scale): #20265 when dataZomm.filterMode is “empty” or ‘none’, the line graph is scaled to only one category, it is not filtered correctly#20495

Open
linlang171 wants to merge 3 commits intoapache:masterfrom
linlang171:fix/20265

Conversation

@linlang171
Copy link
Copy Markdown

@linlang171 linlang171 commented Nov 10, 2024

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

#20265

Fixed issues

Fixes #20265
Fixes #19666

Details

Before: What was the problem?

when dataZomm.filterMode is “empty” or ‘none’, the line graph is scaled to only one category, it is not filtered correctly

image

After: How does it behave after the fixing?

The data is correctly filtered. And The bug is caused by calling the normalize method when calculating rendering values. When extra [1]==extra [0], it does not consider the possibility of NaN and returns 0.5 directly

8182f6148467cd28dbf5856e39d95bb

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
Copy Markdown

echarts-bot Bot commented Nov 10, 2024

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.

⚠️ MISSING DOCUMENT INFO: Please make sure one of the document options are checked in this PR's description. Search "Document Info" in the description of this PR. This should be done either by the author or the reviewers of the PR.

@echarts-bot
Copy link
Copy Markdown

echarts-bot Bot commented Nov 10, 2024

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.

@echarts-bot echarts-bot Bot added the PR: awaiting doc Document changes is required for this PR. label Nov 10, 2024
@linlang171 linlang171 closed this Nov 10, 2024
@echarts-bot echarts-bot Bot added PR: doc unchanged and removed PR: awaiting review PR: awaiting doc Document changes is required for this PR. labels Nov 10, 2024
@linlang171 linlang171 reopened this Nov 10, 2024
@linlang171 linlang171 changed the title fix #20265 when dataZomm.filterMode is “empty” or ‘none’, the line graph is scaled to only one category, it is not filtered correctly fix(scale): #20265 when dataZomm.filterMode is “empty” or ‘none’, the line graph is scaled to only one category, it is not filtered correctly Nov 11, 2024
@linlang171
Copy link
Copy Markdown
Author

@pissang @Ovilia @100pah I have been submitting this merge request for a long time, but no one has reviewed it yet. Now I am facing this issue again. Is it possible that my merge request is incorrect, which is why it hasn't been merged? Or could you please give me some suggestions?

@helgasoft
Copy link
Copy Markdown

@linlang171, respect for your effort.
I have assembled a list of dataZoom bugs and would love to delist some of them.
Usually I do not comment on ECharts code since I don't understand it very well, want to just share some thoughts.

Your PR changes one line in function normalize. Searching further up the ladder on where it is used I find this:
normalize (helper.ts) >> ScaleCalculator (Scale.ts) >> _calculator (Interval.ts, Ordinal.ts, Time.ts)
Your test line-scale.html works with dataset, which I presume falls under Ordinal.ts. But there are two more places where normalize is used - Interval.ts and Time.ts.
Interval.ts could be related to axis and tested with xAxis.data ...? Not sure.
Testing with xAxis:{type:"time"} I find that the current code works fine. How would it work with your update I don't know.
So my point is - maybe more PR tests are needed ? Hard to tell without some feedback from developers...

@linlang171
Copy link
Copy Markdown
Author

@100pah I found that the related codes were previously your commit. Can you help me review this pull request?

@linlang171
Copy link
Copy Markdown
Author

@Ovilia @plainheart @100pah Could you help review this PR?

@Justin-ZS
Copy link
Copy Markdown
Contributor

No blocking issues found in my review. The fix is consistent with the root cause: when the visible extent collapses to a single value, normalize() should no longer map every input to 0.5. I only see a residual test gap around edge categories / continuous axes / axis-break-specific coverage, so adding a few more regression cases would make this safer.

Copy link
Copy Markdown
Contributor

@Justin-ZS Justin-ZS left a comment

Choose a reason for hiding this comment

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

I re-reviewed this PR end to end and did not find any blocking issues. The fix now handles the collapsed-extent normalization consistently in both the regular scale path and the axis-break path, which matches the root cause described in #20265 / #19666.

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

Projects

None yet

3 participants