VChart icon indicating copy to clipboard operation
VChart copied to clipboard

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

Open neuqzxy opened this issue 3 months ago • 0 comments

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

neuqzxy avatar Sep 02 '25 07:09 neuqzxy