Size visual variable themes

This sample demonstrates how to generate a data-driven continuous size visualization with different themes: above, below, and above-and-below. This is accomplished with the createContinuousRenderer() method in the univariateColorSize or size renderer creator objects.

These themes are well suited for some data variables, such as change in population between two years. The layer in this sample uses an Arcade expression to calculate the change in population from 2000 to 2010.

Use dark colors for code blocksCopy
1
2
3
// TOTHU10 = Total population in 2010
// TOTHU00 = Total population in 2000
$feature.TOTHU10 - $feature.TOTHU00

You can create several good visualizations with just that variable. The themes mentioned above help the user answer the following questions.

Where did the number of households increase from 2000-2010?

Theme: above

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
const params = {
  layer,
  view,
  theme: `above`,
  valueExpression: `$feature.TOTHU10 - $feature.TOTHU00`,
  valueExpressionTitle: `Increase in number of households 2000-2010`,
  minValue: -1000,
  maxValue: 2000
};

const { renderer } = await sizeRendererCreator.createContinuousRenderer(params);
layer.renderer = renderer;
size-themes-above

Where did the number of households decrease from 2000-2010?

Theme: below

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
const params = {
  layer,
  view,
  theme: `below`,
  valueExpression: `$feature.TOTHU10 - $feature.TOTHU00`,
  valueExpressionTitle: `Decrease in number of households 2000-2010`,
  minValue: -1000,
  maxValue: 2000
};

const { renderer } = await sizeRendererCreator.createContinuousRenderer(params);
layer.renderer = renderer;
size-themes-below

Where did the number of households increase or decrease from 2000-2010?

Theme: above-and-below

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const params = {
  layer,
  view,
  theme: `above-and-below`,
  valueExpression: `$feature.TOTHU10 - $feature.TOTHU00`,
  valueExpressionTitle: `Change in number of households 2000-2010`,
  symbolOptions: {
    // Other symbol styles include the following:
    //
    // "caret" | "circle-caret" | "arrow" | "circle-arrow" |
    // "plus-minus" | "circle-plus-minus" | "square" | "circle" |
    // "triangle" | "happy-sad" | "thumb"
    symbolStyle: "arrow"
  }
  minValue: -1000,
  maxValue: 2000
};

const { renderer } = await univariateColorSizeRendererCreator.createContinuousRenderer(params);
layer.renderer = renderer;
size-themes-above-and-below

A word of caution

Keep in mind that generating renderers should be avoided in most applications because of the performance cost affecting the end user. As stated in the Smart Mapping guide topic, the Smart Mapping APIs were designed for two types of applications: data exploration apps and visualization authoring apps similar to ArcGIS Online. In all other cases, renderers should be saved to the layer or manually created using any of the renderer classes.

Additional visualization samples and resources

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.