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(label): support align for min/max labels #19228

Merged
merged 2 commits into from Dec 26, 2023
Merged

Conversation

Ovilia
Copy link
Contributor

@Ovilia Ovilia commented Oct 20, 2023

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

In some cases, especially when the canvas size is limited, we wish to confine the axis labels to be within an area rather than may be outside of the canvas when the label text is long. In this PR, I proposed a way to set align/verticalAlign for the first and last labels so that we can make sure they are within the boundary of the grid area.

Fixed issues

#19215

Details

Before: What was the problem?

The first and last label may be too long to be displayed when the text is long and the canvas size is limited.

image

After: How does it behave after the fixing?

When setting alignMinLabel: 'left', alignMaxLabel: 'right' we can make sure the text is within the grid's width and the inner labels may hide when overlap.

image

Document Info

One of the following should be checked.

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

echarts-bot bot commented Oct 20, 2023

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.

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.

@Ovilia Ovilia added this to the 5.5.0 milestone Oct 20, 2023
@github-actions
Copy link
Contributor

The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-19228@3ea1970

@harshsharma-11
Copy link

@Ovilia hllo mam myself harsh ,mam i am new to apache so i want to join its slack but i don't have email auhtorised by apache with workspace @apache.org so how can i join the slack

@Ovilia
Copy link
Contributor Author

Ovilia commented Oct 23, 2023

@Ovilia hllo mam myself harsh ,mam i am new to apache so i want to join its slack but i don't have email auhtorised by apache with workspace @apache.org so how can i join the slack

Hi, we don't use Slack. Please subscribe our mailing list.

@harshsharma-11
Copy link

@Ovilia hllo mam myself harsh ,mam i am new to apache so i want to join its slack but i don't have email auhtorised by apache with workspace @apache.org so how can i join the slack

Hi, we don't use Slack. Please subscribe our mailing list.

okk sure mam

@pissang
Copy link
Contributor

pissang commented Nov 20, 2023

Will it be more flexible if we can provide something like minLabelStyle / maxLabelStyle?

@Ovilia
Copy link
Contributor Author

Ovilia commented Nov 27, 2023

Will it be more flexible if we can provide something like minLabelStyle / maxLabelStyle?

@pissang Thanks for reminding. I think it should be enough with alignment for the first and last label, because the first / last label should not be more important than the others (think the case with dataZoom, where the first label is not fixed). The reason why we need alignMinLabel and alignMaxLabel is to avoid overriding the canvas, instead of wanting to make them distinctive. Also, if we provide minLabelStyle / maxLabelStyle with exact attributes like axisLabel, it may bring more bugs without a thorough test.

So, I would suggest provide alignMinLabel and alignMaxLabel unless developers expressed requirements beyout that. Hope this makes sense to you. Thanks.

@Ovilia Ovilia merged commit b69e163 into master Dec 26, 2023
2 checks passed
@Ovilia Ovilia deleted the feat-axis-align-lastLabel branch December 26, 2023 10:11
Copy link

echarts-bot bot commented Dec 26, 2023

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

@Ovilia Ovilia mentioned this pull request Jan 25, 2024
8 tasks
Ovilia added a commit to apache/echarts-doc that referenced this pull request Feb 4, 2024
@echarts-bot echarts-bot bot added PR: doc ready and removed PR: awaiting doc Document changes is required for this PR. labels Feb 4, 2024
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