apache / echarts

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

[Feature] 旭日图label文字沿着弧线分布 #20287

Open sentimental114 opened 3 weeks ago

sentimental114 commented 3 weeks ago

What problem does this feature solve?

旭日图中,名称稍长,按照原先label沿着固定方向直线排列的方式,可能会很突兀。而沿着弧线会使整体看起来更和谐,并且也能容纳更多的文字。之前貌似也有人需求该功能,可惜的是当时并不能满足,不知现在能否实现。

What does the proposed API look like?

在旭日图的label配置中添加一个是否沿弧线排列即可。

echarts-bot[bot] commented 3 weeks ago

@sentimental114 It seems you are not using English, I've helped translate the content automatically. To make your issue understood by more people and get helped, we'd like to suggest using English next time. 🤗

TRANSLATED
**TITLE** The Rising Sun Chart label text is distributed along an arc **BODY** ### What problem does this feature solve? In the sunburst chart, the name is slightly longer, and it may be very abrupt according to the original way of arranging the labels in a straight line along a fixed direction. Following the arc will make the whole look more harmonious and can also accommodate more text. It seems that some people have requested this function before, but unfortunately it was not satisfied at the time. I wonder if it can be implemented now. ### What does the proposed API look like? Just add whether to arrange along the arc in the label configuration of the sunburst chart.
Ovilia commented 2 weeks ago

Canvas/SVG don't have methods to render text along a path so I'm afraid such a feature would be hard to implement.

sentimental114 commented 2 weeks ago

Canvas/Svg seems to have a textPath attribute. Can we reserve an API to define this textPath, so that the text can be distributed along the curved edge of the rising sun chart(sunburst)

Ovilia commented 2 weeks ago

You are welcomed to make a pull request to https://github.com/ecomfe/zrender

sentimental114 commented 2 weeks ago

Okay I'll give it a try

sentimental114 commented 2 weeks ago

Now, using rich text on labels, setting an arc-shaped font image as the background can also be achieved, but it is still too cumbersome because not only do we need to gradually confirm the position of the image, but we also need to set separate rules for each layer. For this reason, many levels of interaction have also been removed. I still hope to add this feature in the future