Composite graphic symbol

3686
5
Jump to solution
09-06-2015 05:49 PM
RainerFarsch
New Contributor III

I would like to render a circular graphic symbol, but with text inside the circle. For a simple example, I have the following class break example where I would like to set text inside the circle:

ClassBreakInfo {

    minimum: 11.9

    maximum: 12.1

    symbol: SimpleMarkerSymbol {

        color: "limegreen"

        size: 2

    }

}

Is there a way to add text to a SimpleMarkerSymbol. I see there isn't a property for text. Is there a way to composite SimpleMarkerSymbol and TextSymbol that I can bind to 'symbol:' ?

Thanks.

0 Kudos
1 Solution

Accepted Solutions
ThomasDunn
Occasional Contributor

Ranier,

No, many class breaks for many text strings is not what I had in mind. Rather, I was thinking of static text for each class break, such as "small", "medium" and "large". This would be an unusual scenario.

As you have noted, there is no built-in provision for adding label text to a class break renderer's symbols. If you were displaying features from a dynamic map service, you could label features in various ways using DynamicLayerInfo.DrawingInfo.LabelingInfo.

The best you can do with graphics now is to display two co-located graphics per feature, one a marker symbol and another a text symbol built using an attribute from the graphic.

View solution in original post

0 Kudos
5 Replies
ThomasDunn
Occasional Contributor

Ranier,

Question: Would your text be static or supplied from an attribute or other dynamic source?

Thanks.

0 Kudos
RainerFarsch
New Contributor III

Thomas,

That's a good question. If the text is static, then I would need a good number of ClassBreakInfo components - one for each unique text case!? If the text is set as an attribute then that would reduce the number of ClassBreakInfo components that I would need. Once the text is set for the graphic, it won't change for the life of the graphic.

So my answer is: it depends. I would be interested in hearing both solutions (if they exist) for the static and dynamic case.

Thanks.

-Rainer

0 Kudos
ThomasDunn
Occasional Contributor

Ranier,

No, many class breaks for many text strings is not what I had in mind. Rather, I was thinking of static text for each class break, such as "small", "medium" and "large". This would be an unusual scenario.

As you have noted, there is no built-in provision for adding label text to a class break renderer's symbols. If you were displaying features from a dynamic map service, you could label features in various ways using DynamicLayerInfo.DrawingInfo.LabelingInfo.

The best you can do with graphics now is to display two co-located graphics per feature, one a marker symbol and another a text symbol built using an attribute from the graphic.

0 Kudos
RainerFarsch
New Contributor III

Thomas,

Thanks. Here's a related question. Is it possible to change the color of a symbol based on a graphic's attribute given that a SimpleRenderer is used? Using sample code from ArcGIS Runtime SDK for Qt QML API: SimpleRenderer Class Reference (below), is it possible to use JS for the 'color:' binding to select color based on a graphic's attribute, or do I need to use a ClassBreakRender?

GraphicsLayer {

          id: graphicsLayer

          renderer: simple

      }

 

      SimpleRenderer {

          id: simple

          symbol: SimpleFillSymbol {

              style: Enums.SimpleFillSymbolStyleForwardDiagonal

              color: "#9050d5"

              outline: SimpleLineSymbol {

                  color: "darkgrey"

                  width: 1

              }

          }

     }

0 Kudos
ThomasDunn
Occasional Contributor

Ranier,

Sorry, not through the renderer. You cannot bind the color property of a shared symbol to varying attribute values of individual graphics. You could instead create a new symbol for each graphic, where the color of the symbol is based on a graphic attribute.

0 Kudos