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

fix(axis): fix charts render abnormally when yAxis.max is set to be a value less than the min value of the series data. #15878

Merged
merged 1 commit into from
Oct 27, 2021

Conversation

plainheart
Copy link
Member

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

In ECharts 5.x, the line/bar chart renders abnormally when yAxis.max is set to be a value less than the min value of the series data. See #14812 for more details.

I'm not sure if the root cause was found. Related commit is b116faa in PR #12832.

Fixed issues

Details

Before: What was the problem?

After: How is it fixed in this PR?

Misc

  • The API has been changed (apache/echarts-doc#xxx).
  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

Please refer to test/axis-filter-extent2.html

Others

Merging options

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

Other information

@echarts-bot
Copy link

echarts-bot bot commented Oct 14, 2021

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.

The pull request is marked to be PR: author is committer because you are a committer of this project.

…alue less than the min value of the series data.
@plainheart plainheart changed the base branch from next to master October 20, 2021 02:46
@@ -201,11 +201,6 @@ export class ScaleRawExtentInfo {
(min == null || !isFinite(min)) && (min = NaN);
(max == null || !isFinite(max)) && (max = NaN);

if (min > max) {
min = NaN;
max = NaN;
Copy link
Contributor

Choose a reason for hiding this comment

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

This change looks good in the example. Are there any concerns at the time we adding this logic @100pah

Copy link
Member Author

Choose a reason for hiding this comment

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

#15910 seems to state another potential enhancement where min is identical to max.

Copy link
Member

Choose a reason for hiding this comment

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

Just consider that if min is set to be bigger than max, it does not make sense to display the chart.

Copy link
Member Author

@plainheart plainheart Oct 20, 2021

Choose a reason for hiding this comment

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

I agree. But the NaN value brought an unexpected behavior. Maybe it's not a good idea to change here.

Copy link
Contributor

@pissang pissang Oct 20, 2021

Choose a reason for hiding this comment

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

I think we can remove NaN logic here. Then think about how should we handle the case when min/max are invalid.

Copy link
Contributor

Choose a reason for hiding this comment

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

@100pah So should we merge this PR and keep improving in further PRs?

@pissang pissang merged commit e66d871 into master Oct 27, 2021
@pissang pissang deleted the fix-yaxis-max branch October 27, 2021 01:44
@echarts-bot
Copy link

echarts-bot bot commented Oct 27, 2021

Congratulations! Your PR has been merged. Thanks for your contribution! 👍

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

3 participants