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): provide splitLine.showMinLine and splitLine.showMaxLine. … #16947

Closed
wants to merge 3 commits into from

Conversation

MeetzhDing
Copy link

@MeetzhDing MeetzhDing commented Apr 27, 2022

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

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:
uplot styles

After: How is it fixed in this PR?

Like showMinLabel/showMaxLabel, it add new option showMinLine adn showMaxLine.

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

@echarts-bot
Copy link

echarts-bot bot commented Apr 27, 2022

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.

@pissang
Copy link
Contributor

pissang commented Apr 27, 2022

Please don't commit the files in the dist folder

src/coord/Axis.ts Outdated Show resolved Hide resolved
@pissang pissang added this to the 5.4 milestone Apr 27, 2022
@Ovilia
Copy link
Contributor

Ovilia commented May 26, 2022

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 -20 and it is expected to be displayed because -20 is a nice tick.

image

While in another case, the axis is set to have min: -22. In this case, the splitLine of -22 is expected to be hidden if showMinLine is set to be false.

image

I think this logic may make more sense. @pissang What do you think?

@MeetzhDing
Copy link
Author

@Ovilia @pissang
how to judge whether it is nice tick? Or is this any plan yet?

@Ovilia
Copy link
Contributor

Ovilia commented Jul 27, 2022

@MeetzhDing Sorry for the late reply. You can find the code here.

@MeetzhDing
Copy link
Author

@Ovilia showMinLine type is boolean | 'auto' now

    // 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',

@Ovilia Ovilia modified the milestones: 5.4, 5.4.1 Sep 1, 2022
@Ovilia Ovilia requested a review from pissang September 2, 2022 07:48
src/component/axis/CartesianAxisView.ts Outdated Show resolved Hide resolved
src/component/axis/CartesianAxisView.ts Outdated Show resolved Hide resolved
src/coord/axisCommonTypes.ts Outdated Show resolved Hide resolved
@MeetzhDing
Copy link
Author

@Ovilia please check pr again

@MeetzhDing
Copy link
Author

@Ovilia please check pr again

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.

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.

src/component/axis/CartesianAxisView.ts Outdated Show resolved Hide resolved
src/component/axis/CartesianAxisView.ts Show resolved Hide resolved
@@ -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) {
Copy link
Contributor

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?

Copy link
Author

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

Copy link
Contributor

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 Show resolved Hide resolved
@@ -534,8 +540,68 @@ <h1>Test xAxis.axisTick.interval</h1>



<script>

require([
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

!showMinLine should be better.

@MeetzhDing
Copy link
Author

image

image

@Ovilia please check again

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.

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) {
Copy link
Contributor

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?

@echarts-bot
Copy link

echarts-bot bot commented Nov 15, 2022

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 15, 2022
@plainheart plainheart modified the milestones: 5.4.1, 5.5.0 Nov 20, 2022
@Ovilia Ovilia modified the milestones: 5.5.0, 5.5.1 Jan 18, 2024
@Ovilia Ovilia modified the milestones: 5.5.1, 5.5.2 Jun 28, 2024
@plainheart plainheart removed this from the 5.5.2 milestone Jul 18, 2024
@plainheart
Copy link
Member

Superseded by #20114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: awaiting doc Document changes is required for this PR. PR: first-time contributor size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] xAxis splitLine showMinLine showMaxLine
4 participants