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

[Bug] Layout of wordCloud is not compact enough even the word.padding is small #522

Closed
da730 opened this issue Aug 14, 2023 · 2 comments · Fixed by #1052
Closed

[Bug] Layout of wordCloud is not compact enough even the word.padding is small #522

da730 opened this issue Aug 14, 2023 · 2 comments · Fixed by #1052
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@da730
Copy link
Contributor

da730 commented Aug 14, 2023

Version

1.1.0

Link to Minimal Reproduction

null

Steps to Reproduce

{
"type": "wordCloud",
"nameField": "230814160950023",
"fontSizeRange": [
10,
50
],
"fontWeightRange": [
400,
400
],
"random": false,
"wordCloudConfig": {
"zoomToFit": {
"shrink": true,
"enlarge": true,
"fontSizeLimitMin": 5
}
},
"word": {
"padding": 1
},
"maskShape": "pentagon",
"data": [
{
"id": "data",
"values": [
{
"230814160950023": "浙江"
},
{
"230814160950023": "四川"
},
{
"230814160950023": "江苏"
},
{
"230814160950023": "广东"
},
{
"230814160950023": "江西"
},
{
"230814160950023": "陕西"
},
{
"230814160950023": "黑龙江"
},
{
"230814160950023": "山东"
},
{
"230814160950023": "上海"
},
{
"230814160950023": "河北"
},
{
"230814160950023": "福建"
},
{
"230814160950023": "安徽"
},
{
"230814160950023": "甘肃"
},
{
"230814160950023": "吉林"
},
{
"230814160950023": "辽宁"
},
{
"230814160950023": "湖北"
},
{
"230814160950023": "河南"
},
{
"230814160950023": "湖南"
},
{
"230814160950023": "北京"
},
{
"230814160950023": "重庆"
},
{
"230814160950023": "青海"
},
{
"230814160950023": "广西"
},
{
"230814160950023": "天津"
},
{
"230814160950023": "云南"
},
{
"230814160950023": "海南"
},
{
"230814160950023": "贵州"
},
{
"230814160950023": "山西"
},
{
"230814160950023": "内蒙古"
},
{
"230814160950023": "宁夏"
},
{
"230814160950023": "新疆"
},
{
"230814160950023": "西藏自治区"
}
],
"fields": {
"230814160950023": {
"alias": "省/自治区"
}
}
}
],
"seriesField": "230814160950023",
"color": {
"field": "230814160950023",
"type": "ordinal",
"range": [
"#009db5",
"#f2b823",
"#eb7006",
"#1f5273",
"#3da241",
"#77bfc8",
"#d44977",
"#ef85a7",
"#675dae",
"#b6bc65",
"#829e0b",
"#a6a6e1",
"#009db5",
"#f2b823",
"#eb7006",
"#1f5273",
"#3da241",
"#77bfc8",
"#d44977",
"#ef85a7",
"#675dae",
"#b6bc65",
"#829e0b",
"#a6a6e1",
"#009db5",
"#f2b823",
"#eb7006",
"#1f5273",
"#3da241",
"#77bfc8",
"#d44977"
],
"specified": {}
},
"tooltip": {
"handler": {}
},
"background": "rgba(255, 255, 255, 0)",
"animation": false,
"hash": "ace4f52b55b385b2396f054fe6f2132b"
}

Current Behavior

image
76975216-cab0-4fd4-a919-273b66045c03

Expected Behavior

just like 3.x:
image
0d83a993-76e9-4649-ac53-a6581b8909d7

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

@da730 da730 added the enhancement New feature or request label Aug 14, 2023
@da730 da730 added this to the v1.2.1 milestone Aug 14, 2023
@kkxxkk2019 kkxxkk2019 modified the milestones: v1.2.1, v1.3.0 Aug 15, 2023
@kkxxkk2019 kkxxkk2019 modified the milestones: v1.3.0, v1.3.1, v1.3.2 Aug 31, 2023
@kkxxkk2019 kkxxkk2019 modified the milestones: v1.3.2, v1.4.0 Sep 14, 2023
@skie1997
Copy link
Contributor

skie1997 commented Sep 20, 2023

there is no difference in layout of 3.x and 4.x wordcloud:
3.x和4.x的词云布局算法没有改变:

3.x:
Image

4.x:

Image

@skie1997
Copy link
Contributor

skie1997 commented Sep 20, 2023

The reason for this phenomenon is that 3.x has fontSize config and default value is 20, but 4.x has not fontSize config and value is fontSizeRange[0], so when you set fontSizeRange to [0, 50], 3.x get fontSize value is 20, but 4.x get fontSize value is 10.
In general, you can set fontSizeRange[0] to 20 to slove the problem.

造成这个现象的原因是在3.x里面有fontSize这个配置并且默认值是20,而在4.x里面没有fontSize,默认会取fontSizeRange[0]。在你的配置中,fontSizeRange设置成了[10, 50], 3.x得到的fontSize是默认值20,而4.x得到的fontSize是10。
所以,可以通过将fontSizeRange[0]设置成20来解决这个问题。

3.x表现:

Image

4.x表现:
Image

4.x将fontSizeRange[0]设置为20的表现:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants