-
Notifications
You must be signed in to change notification settings - Fork 19.7k
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): provide splitLine.showMinLine and splitLine.showMaxLine. … #16947
Conversation
Thanks for your contribution! |
Please don't commit the files in the dist folder |
I have some concern on this PR. I think it may be a better idea to hide min/max line only if the first/last tick is not calculated by nice tick (which usually happens when the user deliberately sets a min/max value to the axis. For example, in this demo, the min tick is While in another case, the axis is set to have I think this logic may make more sense. @pissang What do you think? |
@MeetzhDing Sorry for the late reply. You can find the code here. |
@Ovilia showMinLine type is // null/undefined (true) | true | false | 'auto' (true when nick tick only)
showMinLine?: boolean | 'auto',
// null/undefined (true) | true | false | 'auto' (true when nick tick only)
showMaxLine?: boolean | 'auto', |
633c6f0
to
a31e928
Compare
@Ovilia please check pr again |
a31e928
to
8be4e47
Compare
@Ovilia please check pr again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! I think the PR is close to the solution, only a few small tips.
Also, if you don't have some special reason, please use regular push instead of force push. Otherwise, the robot may not tag the PR to be revision state.
@@ -135,6 +136,30 @@ const axisElementBuilders: Record<typeof selfBuilderAttrs[number], AxisElementBu | |||
tickModel: splitLineModel | |||
}); | |||
|
|||
const axisScale = axis.scale as IntervalScale; | |||
if (ticksCoords.length > 2 && axisScale.getInterval) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if ticksCoords.length
is 2
but the data range is not equal to the ticks' values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When ticksCoords length is 2, the splitLine is not expected to be hidden
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? For example, when data range is 11~19 and ticksCoords is [10, 20], I believe there should be no split line, right?
test/axis-interval.html
Outdated
@@ -534,8 +540,68 @@ <h1>Test xAxis.axisTick.interval</h1> | |||
|
|||
|
|||
|
|||
<script> | |||
|
|||
require([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add more test cases to test boundary situations. You may start with the cases in my above questions.
const interval = axisScale.getInterval() || null; | ||
|
||
const showMinLine = splitLineModel.get('showMinLine'); | ||
if (showMinLine === false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!showMinLine
should be better.
@Ovilia please check again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've run visual tests and LGTM. @plainheart would you like to double-check this PR?
@@ -135,6 +136,30 @@ const axisElementBuilders: Record<typeof selfBuilderAttrs[number], AxisElementBu | |||
tickModel: splitLineModel | |||
}); | |||
|
|||
const axisScale = axis.scale as IntervalScale; | |||
if (ticksCoords.length > 2 && axisScale.getInterval) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? For example, when data range is 11~19 and ticksCoords is [10, 20], I believe there should be no split line, right?
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 |
Superseded by #20114 |
Brief Information
This pull request is in the type of:
What does this PR do?
Resolves #16946
provide splitLine.showMinLine and splitLine.showMaxLine.
When using xAxis[type=time], it allow user hide first/last splitLine.
uplot style:
After: How is it fixed in this PR?
Like showMinLabel/showMaxLabel, it add new option
showMinLine
adnshowMaxLine
.Document Info
One of the following should be checked.