Labels with Graphics Layer Renderer?
I have a workflow that returns a single point on the map. I have the custom SimpleMarkerSymbol figured out, but I would like to add a label or text next to the point with values from a stored variable I have already stored earlier in my workflow. I am adding my custom symbol via the "UpdateGraphicsLayer" renderer.
I've seen examples for points, lines and polygons, but none with text/labels. Can this been done in the 'UpdateGraphicsLayer' tool or do I need to take a different approach?
Thanks!
-
I've got the text to appear. Now I'm just working on formatting.
I did this by creating a string variable called 'textLabel' to concatenate my required variables. Next, with my single point added to a feature set, I used 'UpdateGraphicsLayer' tool. I gave it a new Layer ID, added my existing feature set and used the following renderer string:
New ESRI.ArcGIS.Client.SimpleRenderer() With { .Symbol = New ESRI.ArcGIS.Client.Symbols.TextSymbol() with {.Text = textLabel } }
Here's what the output looks like:
/customer/servlet/servlet.FileDownload?file=00P6000000eltyXEAQ
If anyone has suggestions on how to offset the label and format the font, I'd appreciate it.
Thanks!
0 -
I've got the offset figured out. But I would like to change the font size and make it bold. Any suggestions?
Here's the renderer string in 'Update Graphics Layer' tool that I am using where textLabel is my concatenated string for the label text.
New ESRI.ArcGIS.Client.SimpleRenderer() With { .Symbol = New ESRI.ArcGIS.Client.Symbols.TextSymbol() With {.Text = textLabel, .OffsetX = -20, .OffsetY = 5} }
Thanks!
0 -
Mark,
This will get you your fontsize, plus fontfamily and foreground. Still working on Fontstyle which is not a member of TextSymbol class.
New ESRI.ArcGIS.Client.SimpleRenderer() With { .Symbol = New ESRI.ArcGIS.Client.Symbols.TextSymbol() With {.Text = textLabel, .FontSize = 35, .OffsetX = -20, .OffsetY = 5, .FontFamily = New System.Windows.Media.FontFamily("Arial"), .Foreground = New System.Windows.Media.SolidColorBrush(Colors.Red)}}
Rick
0 -
Mark,
Here is the addition of "FontWeight".
New ESRI.ArcGIS.Client.SimpleRenderer() With { .Symbol = New ESRI.ArcGIS.Client.Symbols.TextSymbol() With {.Text = textLabel, .FontSize = 35, .OffsetX = -20, .OffsetY = 5, .FontFamily = New System.Windows.Media.FontFamily("Arial"), .Foreground = New System.Windows.Media.SolidColorBrush(Colors.Red), .FontWeight = FontWeights.Bold}}
Thanks for posting this thread.
Rick
0 -
Perfect. Thanks Rick!
0 -
We will add Rick's example to the list of expression suggestions that Workflow Designer provides for renderers in an upcoming version.
--Ryan
0 -
I found two more renders for FontSyles (Italic) and TextDecorations (UnderLine).
/customer/servlet/servlet.FileDownload?file=00P6000000elzkyEAA
New ESRI.ArcGIS.Client.SimpleRenderer() With { .Symbol = New ESRI.ArcGIS.Client.Symbols.TextSymbol() With {.Text = myPoint.X.ToString + " , " + myPoint.Y.ToString, .FontSize = 35, .OffsetX = -20, .OffsetY = 5, .FontFamily = New System.Windows.Media.FontFamily("Arial"), .Foreground = New System.Windows.Media.SolidColorBrush(Colors.Red), .FontWeight = FontWeights.Bold, .FontStyle = FontStyles.Italic, .TextDecorations = TextDecorations.Underline}}
Example renders for FontWeight and FontStyles can be found in the System.Windows Namespace
.FontWeight = FontWeights.Bold
https://msdn.microsoft.com/en-us/library/system.windows.fontweights(v=vs.110).aspx.FontStyle = FontStyles.Italic
https://msdn.microsoft.com/en-us/library/system.windows.fontstyles(v=vs.110).aspxExample renders for Textdecorations can be found in the System.Windows.Controls.TextBlock Class, TextBlock Properties
.TextDecorations = TextDecorations.Underline
https://msdn.microsoft.com/en-us/library/system.windows.controls.textblock.textdecorations(v=vs.110).aspxRegards, Rick
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
7 Kommentare