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

fixed issue #19187 #19399

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/coord/scaleRawExtentInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,20 @@ export class ScaleRawExtentInfo {
maxFixed = true;
}

// Use this where only one of the min or max is fixed and the other not.
// You can see the usage of this when testing min-max-axis.html that I created as a test case.
// (https://github.com/apache/echarts/issues/19187)
if ((!maxFixed && minFixed) || (!minFixed && maxFixed)) {
if (min > max) {
max = min + 10;
Copy link
Contributor

Choose a reason for hiding this comment

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

What does the magic number 10 mean here?

Copy link
Author

Choose a reason for hiding this comment

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

@Ovilia, thank you for your response.

My reasoning behind the 10 offset was since the user won't supposed to see any data on the graph with a min that does not get override, the user should still see a range of numbers for the labels.

However, I can change the set magical number logic or set it to something else. I would be happy if I get your further feedback on the topic. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Typically, we provide an option like 'xAxis.xxx' for this value. Thanks!

Copy link
Author

Choose a reason for hiding this comment

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

If I remove the magic number, y axis range becomes 2.5 as min and 5 as max as in the example below. With this, it does not show the data that is not in the ymin range as it should, however, it still ignores the min threshold that the user set (ymin = 5 in this example below).

Would removing the magic number fix the issue or what do you suggest?

Thanks!

Screenshot 2024-01-05 at 7 44 33 PM

maxFixed = true;
}
else if (max < min) {
min = max - 10;
minFixed = true;
}
}

// Ensure min/max be finite number or NaN here. (not to be null/undefined)
// `NaN` means min/max axis is blank.
return {
Expand Down
57 changes: 57 additions & 0 deletions test/min-max-axis.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.