Label wrapping in web map export

512
4
02-26-2023 09:14 PM
julian_svcs
Occasional Contributor

I have a FeatureLayer that I am setting .labelingInfo. In my map view the labels are shown correctly but in my web map export PDF, the label values are wrapped. And ideas how to not wrap the labels in the PDF export?

Labeling code:

const nameArcade = "var in_val = $feature." + label_field + "\n" +
    "var decimal_val_threshold = 1" + "\n" +
    "if (in_val >= decimal_val_threshold) {" +
    " return Text(Round(in_val, 0), '#,###')" +
    "} else {" +
    " return ' <1'" +
    "}";
const nameClass = {
    labelPlacement: "always-horizontal",
    labelExpressionInfo: {
        expression: nameArcade
    },
    minScale: min_scale,
    symbol: createTextSymbol("white", "black")
};
function createTextSymbol(color, halo_color) {
    return {
        type: "text",
        font: {
            size: 12,
            weight: "bold"
        },
        color: color,
        haloColor: halo_color,
        haloSize: 1
    };
}

 

Map view of labels:

julian_svcs_0-1677474707644.png

PDF showing wrapped labels:

julian_svcs_1-1677474791018.png

 

 

0 Kudos
4 Replies
Noah-Sager
Esri Regular Contributor

Hi @julian_svcs, thanks for sharing your issue here. It looks like this might be due to an issue with the print service, we are currently investigating.

The issue is probably caused by the comma and the space constraints, because the comma is a default stacking separator, and it looks like the wrapping only occurs where the space is tight. One workaround suggestion would be to set the deconflictionStrategy to none and see if that helps (or makes it look worse).

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#de...

Another workaround option would be to try returning a number instead of a string from the Arcade expression.

0 Kudos
julian_svcs
Occasional Contributor

Thanks for the reply.

It is the comma in the label when it is printed (which is not the same as the map's labels). It doesn't seem to be because of the tight spaces. See the different scales and how the behave differently. There is also an example of the labels as a number. This is with deconflictionStrategy:"none",.

julian_svcs_0-1677532601686.png

julian_svcs_1-1677532616346.png

julian_svcs_2-1677532640044.png

julian_svcs_3-1677532654731.png

 

 

0 Kudos
Noah-Sager
Esri Regular Contributor

Ok, thanks for trying out those potential workarounds. We'll continue investigating the print service, and will update this thread when there is something useful to share.

0 Kudos
JakeMatthys
Occasional Contributor II

Our team is also experiencing this issue.  Have any viable workarounds or solutions been discovered?

 - Jake

0 Kudos