UnclassedColorsRenderer

サマリー

The UnclassedColorsRenderer class draws quantities using an unclassed color gradient.

説明

The properties behave in a similar manner to the options exposed in the application. For example, changing the field will automatically adjust the upper and lower labels. If you change expression, the field automatically changes to Custom.

プロパティ

プロパティ説明データ タイプ
colorRamp
(読み書き)

Provides access to the ColorRamp object.

ColorRamp
expression
(読み書き)

A string that represents a valid SQL expression. When an expression is applied, the field name in the Symbology pane appears as Custom.

String
field
(読み書き)

A string that represents a valid, numerically defined field name used for setting unclassed colors. A value of None is possible, but it must be changed to a valid field name for the renderer to display properly.

String
lowerLabel
(読み書き)

A string that represents the lower label that appears in the Contents pane or legend.

String
normalizationField
(読み書き)

A string that represents a valid numerically defined field name that is used for normalization.

String
symbolTemplate
(読み取り専用)

Returns a symbol that represents the symbol template for all the features in the layer. To set the template, use the updateSymbolTemplate method.

Symbol
type
(読み取り専用)

Returns a string that represents the renderer type.

String
upperLabel
(読み書き)

A string that represents the upper label that appears in the Contents pane or legend.

String

方法の概要

方法説明
updateSymbolTemplate (symbol_template)

updateSymbolTemplate provides a mechanism to change the renderer's symbol template.

方法

updateSymbolTemplate (symbol_template)
パラメーター説明データ タイプ
symbol_template

A reference to a symbol.

(デフォルト値は次のとおりです None)

Object

The updateSymbolTemplate method allows you to modify the symbol for all the features at once. The symbol template is managed in the application differently and therefore requires a method to set the symbol template to the renderer.

コードのサンプル

UnclassedColorsRenderer example

The following script first tests whether the layer's symbology supports a renderer property. It then confirms whether the renderer type is an UnclassedColorsRenderer. Next, it modifies basic properties such as fields and labels. Next, it applies a system ColorRamp named Yellow to Red. Finally, it modifies the symbolTemplate using a gallery symbol named Black Outline (1pt).

p = arcpy.mp.ArcGISProject('current')
m = p.listMaps('UnclassedColors')[0]
l = m.listLayers('States_WithRegions')[0]

if l.isFeatureLayer:
  sym = l.symbology
  if hasattr(sym, 'renderer'):
    if sym.renderer.type == 'UnclassedColorsRenderer':

      #modify basic properties
      sym.renderer.field = "POP2010"
      sym.renderer.normalizationField = "Shape_Area"
      sym.renderer.lowerLabel = "Upper: " + sym.renderer.lowerLabel
      sym.renderer.upperLabel = "Lower: " + sym.renderer.upperLabel

      #Modify color ramp
      cr = p.listColorRamps('Yellow to Red')[0]
      sym.renderer.colorRamp = cr
      
      #Modify the symbol template
      symTemp = sym.renderer.symbolTemplate
      symTemp.applySymbolFromGallery('Black Outline (1pt)')
      sym.renderer.updateSymbolTemplate(symTemp)

      l.symbology = sym