Skip to content

[Bug] 词云文字重叠bug #4591

@skie1997

Description

@skie1997

Version

2.0.16

Link to Minimal Reproduction

none

Steps to Reproduce

const spec = {
    "__isSeriesWithinPointsSpec": true,
    "__innerSpecType": "WdCloudsSpecType",
    "__ignoreAnimation": false,
    "__resizeTime": 120,
    "type": "wordCloud",
    "data": [
        {
            "name": "0",
            "values": [
                {
                    "group": "0",
                    "name": "图",
                    "value": 7,
                    "dataIndex": 0,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "数据",
                    "value": 7,
                    "dataIndex": 1,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "变化",
                    "value": 5,
                    "dataIndex": 2,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "类别",
                    "value": 5,
                    "dataIndex": 3,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "​",
                    "value": 5,
                    "dataIndex": 4,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "场景",
                    "value": 4,
                    "dataIndex": 5,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "查看",
                    "value": 4,
                    "dataIndex": 6,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "柱状",
                    "value": 3,
                    "dataIndex": 7,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "顺序",
                    "value": 3,
                    "dataIndex": 8,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "折线",
                    "value": 3,
                    "dataIndex": 9,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "趋势",
                    "value": 3,
                    "dataIndex": 10,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "时间",
                    "value": 3,
                    "dataIndex": 11,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "堆积",
                    "value": 2,
                    "dataIndex": 12,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "基础",
                    "value": 2,
                    "dataIndex": 13,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "中",
                    "value": 2,
                    "dataIndex": 14,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "阶梯",
                    "value": 1,
                    "dataIndex": 15,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "平滑",
                    "value": 1,
                    "dataIndex": 16,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "剧烈",
                    "value": 1,
                    "dataIndex": 17,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "百分比",
                    "value": 1,
                    "dataIndex": 18,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "高",
                    "value": 1,
                    "dataIndex": 19,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "规律",
                    "value": 1,
                    "dataIndex": 20,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "量大",
                    "value": 1,
                    "dataIndex": 21,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "精度",
                    "value": 1,
                    "dataIndex": 22,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "时期",
                    "value": 1,
                    "dataIndex": 23,
                    "seriesIndex": 0
                },
                {
                    "group": "0",
                    "name": "系列",
                    "value": 1,
                    "dataIndex": 24,
                    "seriesIndex": 0
                }
            ]
        }
    ],
    "nameField": "name",
    "valueField": "value",
    "colorField": "name",
    "colorMode": "ordinal",
    "fillingColorField": "name",
    "random": false,
    "seriesField": "name",
    "wordCloudConfig": {
        "zoomToFit": {
            "enlarge": true,
            "shrink": true
        }
    },
    "fontSizeRange": [
        20,
        50
    ],
    "tooltip": {
        "visible": true,
        "mark": {
            "content": {}
        }
    },
    "word": {
        "style": {
            "fontWeight": 900,
            "opacity": 1,
            "cursor": "pointer"
        },
        "state": {
            "normal": {
                "stroke": false
            },
            "hover": {
                "scaleX": 1.2,
                "scaleY": 1.2,
                "stroke": false,
                "zIndex": 10
            },
            "hover_reverse": {
                "fillOpacity": 0.5
            }
        }
    },
    "wordCloudShapeConfig": {
        "fillingRotateAngles": [
            0
        ],
        "fontSizeShrinkFactor": 0.8,
        "textLayoutTimes": 4,
        "ratio": 1,
        "fillingRatio": 4,
        "stepFactor": 4,
        "fillingTimes": 10,
        "fillingXStep": 1,
        "fillingYStep": 1,
        "fillingXRatioStep": 0.005,
        "fillingYRatioStep": 0.005,
        "layoutMode": "ensureMappingEnlarge",
        "importantWordCount": 10,
        "globalShinkLimit": 0.2,
        "fontSizeEnlargeFactor": 1.5,
        "fillingColorList": [
            "#82a7fc",
            "#7edafb",
            "#ad82f7",
            "#f7dc82",
            "#f98e8b",
            "#ffba6b"
        ]
    },
    "animationAppear": false,
    "animationEnter": false,
    "legends": false,
    "title": {
        "padding": {
            "bottom": 0
        },
        "visible": true,
        "text": "词云",
        "textStyle": {
            "visible": true
        },
        "subtextStyle": {
            "visible": false
        }
    },
    "padding": {
        "top": 12,
        "right": 12,
        "bottom": 12,
        "left": 12
    },
    "theme": {
        "colorScheme": {
            "default": [
                "#5383f1",
                "#55c6ef",
                "#915eea",
                "#eecb59",
                "#eb6b67",
                "#f2a144",
                "#82a3f0",
                "#7ed1ef",
                "#a982eb",
                "#ebd382",
                "#ed8d8a",
                "#f2b46d",
                "#3b72f2",
                "#1fbaf2",
                "#7f42e9",
                "#f2bf16",
                "#e94f4b",
                "#f2870d",
                "#b4c6f1",
                "#acdef0",
                "#c5adee",
                "#ecdca7",
                "#efb9b6",
                "#f1cca0",
                "#2d5fd2"
            ]
        }
    },
    "maskShape": "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" width=\"401\" height=\"320\"><path d=\"M91.3548 7.57298C140.303 48.1602 182.315 97.5578 214.369 152.252L246.027 121.019C261.039 106.319 279.023 94.7365 298.543 87.1636C289.675 57.1191 275.158 29.401 255.391 4.70218C253.013 1.73238 249.446 0 245.581 0H94.0796C90.0666 0 88.2831 4.99916 91.3548 7.57298Z\"/><path d=\"M179.246 207.639C202.234 217.439 226.163 225.705 250.588 232.288C293.988 244.019 335.207 226.497 355.52 187.692L380.142 138.69C385.642 126.712 392.627 115.625 401 105.528C386.236 100.083 370.68 97.3111 354.628 97.3111C319.205 97.3111 285.813 110.972 260.546 135.72L222.943 172.843C209.616 185.96 194.951 197.641 179.246 207.639Z\"/><path d=\"M0 121.222C0 117.46 4.5084 115.529 7.23325 118.153C73.8683 182.498 153.781 227.54 245.286 252.19C266.937 258.03 288.438 257.684 308.008 251.942C295.82 263.722 282.394 274.216 267.927 283.273C229.482 307.329 185.092 320 139.562 320C91.6542 320 45.3812 306.091 5.64788 279.71C2.17988 277.433 0.0990866 273.523 0.0990866 269.266L0 121.222Z\"/></svg>",
    "colorList": [
        "#4e83fd",
        "#50cefb",
        "#935af6",
        "#fad355",
        "#f76964",
        "#ffa53d"
    ],
    "animation": false,
    "animationUpdate": false,
    "animationExit": false,
    "animationDisappear": false
};

const vchart = new VChart(spec, { dom: CONTAINER_ID });
vchart.renderSync();

// Just for the convenience of console debugging, DO NOT COPY!
window['vchart'] = vchart;

Current Behavior

Image

Expected Behavior

Image

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions