Skip to content

fix(label): propagate the lineOverflow label option. close #14506 #17231

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

Closed
wants to merge 1 commit into from

Conversation

marmelo
Copy link

@marmelo marmelo commented Jun 16, 2022

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Allows to truncate labels that overflow multiple lines by propagating the lineOverflow label option to ZRender.

Fixed issues

Details

Before: What was the problem?

It was not possible to limit the number of lines in labels.
2022-06-17-003410_685x367_scrot

After: How does it behave after the fixing?

Please assume the following configuration:

{
    ...
    xAxis: {
        ...
        axisLabel: {
            ...
            width: 80,  // both width and height are required
            height: 30,  // twice the line height, so only 2 lines are displayed
            lineHeight: 15,
            overflow: 'break',
            lineOverflow: 'truncate'  // the option that is now being propagated
        }
    }
}

2022-06-17-003359_683x343_scrot

Please check axisLabel-lineOverflow.html visual test case for more details.

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

  • Visual test case axisLabel-lineOverflow.html was added.

Others

Merging options

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

Other information

@echarts-bot
Copy link

echarts-bot bot commented Jun 16, 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.

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.

@plainheart
Copy link
Member

plainheart commented Jun 17, 2022

There are two similar PRs #15404, #14214. A member, @pissang, who implemented this function, said,

ellipsis and lineOverflow are not supported in the labels.

For lineOverflow it's mainly because I thought it is not implemented well yet.

@marmelo
Copy link
Author

marmelo commented Jul 20, 2022

Hi @plainheart, I agree the PRs are similar but they are old and eventually been closed.
Can you please advise how to push this change through?

About ellipsis, if we try to override the ellipsis string (... by default) also does not work.
The fix is similar, the ellipsis option is not being propagated to ZRender.
I can add this fix to the current PR or create a new one.

Also, lineOverflow: 'ellipsis' config only works if we have a single row of text.
If we have more than one row (like the example in this issue description) the ellipsis will not be rendered.
This is a missing feature of ZRender, not an ECharts issue.

Copy link
Contributor

This PR has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you wish not to mark it as stale, please leave a comment in this PR. We are sorry for this but 2 years is a long time and the code base has been changed a lot. Thanks for your contribution anyway.

@github-actions github-actions bot added the stale Inactive for a long time. Will be closed in 7 days. label Jul 20, 2024
Copy link
Contributor

This PR has been automatically closed because it has not had recent activity. Sorry for that and we are looking forward to your next contribution.

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/XS stale Inactive for a long time. Will be closed in 7 days.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants