apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.69k stars 19.62k forks source link

feat(label): enforce labelLayout for all state #20476

Open A0nameless0man opened 2 weeks ago

A0nameless0man commented 2 weeks ago

Brief Information

This pull request is in the type of:

What does this PR do?

Make sure labelLayout is enforced to all four state of label.

Fixed issues

labelLayout option ignored in blur state for sunburst chart.

Example

Details

Before: What was the problem?

Current impl of sunburst chart calculates label position in SunburstPiece.ts, and apply it to all display state. However, this impl didn't take labelLayout into account and causes conflict as labelLayout is only applied to normal state for now.

This inconsistency causes strange animation on mouse hover.

After: How does it behave after the fixing?

Now with this pr, labelLayout always takes priority.

Document Info

One of the following should be checked.

Misc

ZRender Changes

Related test cases or examples to use the new APIs

N.A.

Others

Merging options

Other information

As an inexperienced front-end developer, this PR may require more reviews to avoid breaking any existing use cases. Also, I am currently unable to add unit tests for this PR, which may require further processing.

echarts-bot[bot] commented 2 weeks ago

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.

A0nameless0man commented 2 weeks ago

Before

image

image

After

image

A0nameless0man commented 2 weeks ago

Future works

Support blur and emphasis status for labelLayout .

github-actions[bot] commented 2 weeks ago

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

A0nameless0man commented 2 weeks ago

Unit test

There is only one test label-layout has diff except those ut i added. Not sure why. image

Initial state is same. image

And test candlestick-large2 failed because of timeout, likely due to my weak computer and/or wsl overhead.