VisActor / VisActor/VChart

[Bug] 地图初始缩放导致标签防重叠出问题

Open
#4,180 0 comments 0 reactions 1 assignee View on GitHub

@xuefei1313 is already working on this.

Since Oct 15, 2025.

bug
Dominant language
TypeScript
Stars
1.8k
Forks
221
Avg merge
1d 6h
Merged PRs (30d)
26

Description

Version

2.0.4

Link to Minimal Reproduction

2.0.4

Steps to Reproduce

GE这个标签无法显示,zoom缩小后才能显示

Image
const response = await fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/geojson/world.json');
const geojson = await response.json();
VChart.registerMap('world', geojson);

const dataResponse = await fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/geojson/earthquake.json');
const earthquakeData = await dataResponse.json();

const spec = { 
    "type": "map",
    "tooltip": {
        "activeType": "mark",
        "mark": {
            "content": {}
        }
    },
    "color": {
        "type": "linear",
        "domain": [
            32953,
            62454
        ],
        "range": [
            "#7ECECD",
            "#0C9996"
        ]
    },
    "area": {
        "state": {
            "selected": {
                "fillOpacity": 1
            },
            "selected_reverse": {
                "fillOpacity": 0.5
            }
        },
        "style": {
            "fill": {
                "field": "value",
                "scale": "color"
            }
        }
    },
    "data": [
        {
            "values": [
                {
                    "name": "DE",
                    "value": 62454,
                    "is_min": false,
                    "is_max": true,
                    "percentage": 0.4231100151076846,
                    "sparseShow": false
                },
                {
                    "name": "BR",
                    "value": 52200,
                    "is_min": false,
                    "is_max": false,
                    "percentage": 0.3536417649569465,
                    "sparseShow": false
                },
                {
                    "name": "ES",
                    "value": 32953,
                    "is_min": true,
                    "is_max": false,
                    "percentage": 0.22324821993536892,
                    "sparseShow": false
                }
            ]
        }
    ],
    "label": {
        "visible": true,
  
    },
    "nameField": "name",
    "valueField": "value",
    "nameProperty": "name",
    "map": "world",
    "nameMap": {
        "Brazil": "BR",
        "Germany": "GE",
        "Spain": "ES",
        "France": "FR",
        "United Kingdom": "GB",
        "Indonesia": "ID",
        "Ireland": "IE",
        "Italy": "IT",
        "Japan": "JP",
        "Mexico": "MX",
        "Malaysia": "MY",
        "Philippines": "PH",
        "Saudi Arabia": "SA",
        "Singapore": "SG",
        "Thailand": "TH",
        "United States of America": "US",
        "Vietnam": "VN"
    },
    "region": [
        {
            "roam": {
                "blank": true
            },
            "projection": {
                "zoom": 3.175983148731077,
                "center": [
                    -29.4851195,
                    10.607363
                ]
            }
        }
    ],
    "legends": [
        {
            "visible": true,
            "type": "color",
            "field": "value",
            "orient": "top",
            "position": "start"
        }
    ]
};

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

标签被隐藏

Expected Behavior

标签正常展示

Environment
- OS:
- Browser:
- Framework:
Any additional comments?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.