ESRI Js API 4.15:FeatureLayer 标签在所有要素上都不可见
ESRI Js API 4.15 : FeatureLayer labels are not visible on all features
我试图在一个点 FeatureLayer 上显示标签,标签仅对一个特征不可见,但是当地图改变比例时它变得可见,有什么解释吗?
这是我的代码:
"renderer": {
"type": "class-breaks",
"field": "nums",
"classBreakInfos": [
{
"minValue": 0,
"maxValue": 9,
"label": " < 10",
"symbol": {
"type": "picture-marker",
"url": "./assets/picto/nums/vert.png",
"width": 30,
"height": 50
}
},
{
"minValue": 10,
"maxValue": 19,
"label": " 10 à 19",
"symbol": {
"type": "picture-marker",
"url": "./assets/picto/nums/orange.png",
"width": 30,
"height": 50
}
},
{
"minValue": 20,
"maxValue": 1000000,
"label": " > 19",
"symbol": {
"type": "picture-marker",
"url": "./assets/picto/nums/rouge.png",
"width": 30,
"height": 50
}
}
]
},
"labelingInfo": [
{
"labelExpressionInfo": {
"expression": "$feature.nums"
},
"labelPlacement": "center-center",
"symbol": {
"type": "text",
"color": "black",
"haloColor": "white",
"xoffset": -2,
"yoffset": 13,
"font": {
"size": 7,
"family": "sans-serif",
"weight": "bolder"
}
}
}
]
我加入了FeatureLayer标签问题的图片:
根据您的定义,您正在使用默认的冲突消除策略(“静态”)。有时,当发生重叠时,重叠的标签不会显示。取决于这种策略是否有意义的情况。
您可以尝试使用“none”选项来关闭消除冲突,您应该不会遇到这个问题。看来这可能就是你要找的。
labelClass.deconflictionStrategy = "none";
我试图在一个点 FeatureLayer 上显示标签,标签仅对一个特征不可见,但是当地图改变比例时它变得可见,有什么解释吗?
这是我的代码:
"renderer": {
"type": "class-breaks",
"field": "nums",
"classBreakInfos": [
{
"minValue": 0,
"maxValue": 9,
"label": " < 10",
"symbol": {
"type": "picture-marker",
"url": "./assets/picto/nums/vert.png",
"width": 30,
"height": 50
}
},
{
"minValue": 10,
"maxValue": 19,
"label": " 10 à 19",
"symbol": {
"type": "picture-marker",
"url": "./assets/picto/nums/orange.png",
"width": 30,
"height": 50
}
},
{
"minValue": 20,
"maxValue": 1000000,
"label": " > 19",
"symbol": {
"type": "picture-marker",
"url": "./assets/picto/nums/rouge.png",
"width": 30,
"height": 50
}
}
]
},
"labelingInfo": [
{
"labelExpressionInfo": {
"expression": "$feature.nums"
},
"labelPlacement": "center-center",
"symbol": {
"type": "text",
"color": "black",
"haloColor": "white",
"xoffset": -2,
"yoffset": 13,
"font": {
"size": 7,
"family": "sans-serif",
"weight": "bolder"
}
}
}
]
我加入了FeatureLayer标签问题的图片:
根据您的定义,您正在使用默认的冲突消除策略(“静态”)。有时,当发生重叠时,重叠的标签不会显示。取决于这种策略是否有意义的情况。
您可以尝试使用“none”选项来关闭消除冲突,您应该不会遇到这个问题。看来这可能就是你要找的。
labelClass.deconflictionStrategy = "none";