TransparencyInfo Visual Variable

The transparencyInfo visual variable defines the transparency, or opacity, of each feature's symbol based on a numeric attribute field value.

Properties

Property Details
field Attribute field used for setting the transparency of a feature if no valueExpression is provided.
legendOptions Options available for the legend.
normalizationField Attribute field used to normalize the data.
stops An array of transparencyStop objects.
type Specifies the type of visual variable.
Value of this property must be transparencyInfo
valueExpression An Arcade expression evaluating to a number.
valueExpressionTitle The title identifying and describing the associated Arcade expression as defined in the valueExpression property.

Example

Live sample web maps showing use of the transparencyInfo visual variable.

{
  "visualVariables": [
    {
      "type": "transparencyInfo",
      "valueExpression": "var fieldNames = [ \"GRADDEG_CY\", \"BACHDEG_CY\", \"SMCOLL_CY\", \"HSGRAD_CY\" ];\nvar numFields = 4;\nvar maxValueField = null;\nvar maxValue = -Infinity;\nvar value, i, totalValue = null;\nfor(i = 0; i < numFields; i++) {\nvalue = $feature[fieldNames[i]];\nif(value > 0) {\nif(value > maxValue) {\nmaxValue = value;\nmaxValueField = fieldNames[i];\n}\nelse if (value == maxValue) {\nmaxValueField = null;\n}\n}\nif(value != null && value >= 0) {\nif (totalValue == null) { totalValue = 0; }\ntotalValue = totalValue + value;\n}\n}\nvar strength = null;\nif (maxValueField != null && totalValue > 0) {\nstrength = (maxValue / totalValue) * 100;\n}\nreturn strength;",
      "stops": [
        {
          "value": 25,
          "transparency": 85
        },
        {
          "value": 50,
          "transparency": 0
        }
      ],
      "legendOptions": {
        "title": "Strength of predominance"
      }
    }
  ]
}

Feedback on this topic?