Hi,
I wonder if there is possibility to access and change the innerHTML of labels on FeatureLayer.
The approach described here: http://bl.ocks.org/asizer/44e68f03679004094262 does not work because LableLayer is not in 4.0.
Code snippet was:
labelsLayerNode = labelsLayerNode || labelsLayer.getNode();
if (!labelsLayerNode) {
return;
}
var textLabels = dojoQuery('text', labelsLayerNode);
arrayUtil.forEach(textLabels, function(lbl) {
var fieldArr = lbl.innerHTML.split('$');
if (fieldArr.length > 1) {
lbl.innerHTML = fieldArr[0];
for (var i = 1; i < fieldArr.length; i++) {
var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
tspan.setAttributeNS(null, 'x', lbl.getAttributeNS(null, 'x'));
tspan.setAttributeNS(null, 'dy', '1.5em');
tspan.innerHTML = fieldArr[i];
lbl.appendChild(tspan);
}
}
});
The task is to split the label to multiple lines and set different colors for each line (in 4.0 there is no problem to do the line spliting:
labelExpressionInfo: {
value: '{OBJECTID}\n{OBJECTID}'
},
but what about the different colors?
Thanks for help.
Filip