var parcelsColor = new dojo.Color("#333"); var parcelsTextSymbol = new esri.symbols.TextSymbol().setColor(parcelsColor).setAngle(200); var parcelsLabelRenderer = new esri.renderers.SimpleRenderer(parcelsTextSymbol); var parcelsLabel = new esri.layers.LabelLayer({ id: "parcelsLabel" }); parcelsLabel.addFeatureLayer(parcelLayer, parcelsLabelRenderer, "${" + labelField + "}"); map.addLayer(parcelsLabel);
I'm on JS API 3.7. I tried the new LabelLayer feature. Everything else works fine but I cannot rotate the text. I thought setAngle() in TextSymbol will do that. Turns out nothing get rotated, any idea?
Here's how I use it.var parcelsColor = new dojo.Color("#333"); var parcelsTextSymbol = new esri.symbols.TextSymbol().setColor(parcelsColor).setAngle(200); var parcelsLabelRenderer = new esri.renderers.SimpleRenderer(parcelsTextSymbol); var parcelsLabel = new esri.layers.LabelLayer({ id: "parcelsLabel" }); parcelsLabel.addFeatureLayer(parcelLayer, parcelsLabelRenderer, "${" + labelField + "}"); map.addLayer(parcelsLabel);
Thanks!
Hi,
I found in the API documentation that the label rotation is applicable to Line feature only.Parameter: labelOptions
[TABLE="class: grid"]OptionAvailable ValuesDefault ValueApplicable Feature TypelabelRotationtrue | false trueLine
[/TABLE]
{
lineLabelPosition: "OnLine",
labelRotation: false
}Although when I tried to use the .setAngle and rotate using the labelRotation:true it didnt work. The other options seems to be working like lineLabelPosition:"Below"
Check this fiddle for reference: http://jsfiddle.net/patelmanya/WAVYL/10/
Since this is in BETA I think this might be a bug and esri might fix this with the final/next release.
Hope this helps. If you do find any workaround please post it.
Happy weekend!!!
Regards,
Manish Patel
I'd like to clarify: the request is to have the label layer use the angle set on text symbols? This currently isn't possible with the label layer (as you found out, text symbol rotation is ignored). This complicates things in terms of finding overlapping labels but I'll see what we can do.
Yes. I would like to set the angle on the text symbols.
As of overlapping, they currently overlap anyways. That's why I have to rotate them. I could have gone the other way to fix in my situation.
That shouldn't be happening. Can you provide a repro case that shows using the label layer where it places overlapping labels?
Looks like this has been fixed in 3.9.