Item page
CodePen
Sandbox Download

Educational attainment by census tract visualized using a pie chart style.

What is a chart style?

A chart style visualizes two or more numeric attributes as a chart for each feature in a layer. You can use this style to visualize any variable with sub-categories such as the following:

  • Votes earned per candidate in an election
  • Languages spoken in the home
  • Race and ethnicity

How chart styles work

The pie chart style is configured with a PieChartRenderer. Currently, this is the only chart-based renderer available. A pie chart renderer requires a list of attributes (minimum of two) that match a color with a data value returned from a field or Arcade expression.

The resulting renderer will use the color of each attribute to create a slice proportional to the value returned from the field or expression. The othersCategory defines a color used to shade wedges smaller than a given threshold. This helps consolidate small wedges that are otherwise too small to read.

Examples

Pie charts

Avoid chart overlap. A fixed chart size may work at an initial scale, but chart sizes should grow as you zoom in and shrink as you zoom out.

Map Viewer allows only two Arcade expressions in the Styles pane, so this web map cannot include all the calculated categories used in the JavaScript example. As a workaround, calculate additional categories into layer fields before styling them.
Item page
CodePen
Sandbox Download
Educational attainment is visualized with same-sized pie charts for each census tract at the initial map scale.
Charts - pie
20 collapsed lines
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Charts - pie</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
<style>
html,
body {
height: 100%;
margin: 0;
}
</style>
</head>
<body>
<arcgis-map item-id="2e36e5cdf8c444fdbe811018eb0cb14f">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-expand slot="top-right">
<arcgis-legend></arcgis-legend>
</arcgis-expand>
</arcgis-map>
2 collapsed lines
</body>
</html>

Pie charts with size

Varying pie chart sizes by the total or sum of all categories helps provide meaningful perspective to the map. Some patterns that emerge in pie chart styles may not be important if they represent very small populations. On the other hand, areas with large populations become more prominent when properly sized.

To vary pie charts by size, create a size variable using an Arcade expression that returns the sum of all categories considered in the pie chart’s attributes.

Map Viewer allows only two Arcade expressions in the Styles pane, so this web map cannot include all the calculated categories used in the JavaScript example. As a workaround, calculate additional categories into layer fields before styling them.
Item page
CodePen
Sandbox Download
Pie chart size varies by the population age 25 and older in each census tract.
Charts - pie with size
20 collapsed lines
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Charts - pie with size</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
<style>
html,
body {
height: 100%;
margin: 0;
}
</style>
</head>
<body>
<arcgis-map item-id="687f68d1c55e449db4c16450f15b16e3">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-expand slot="top-right">
<arcgis-legend></arcgis-legend>
</arcgis-expand>
</arcgis-map>
2 collapsed lines
</body>
</html>

Donut charts

Some people prefer to represent pie charts in a donut shape. This is easily configured by setting the holePercentage property of the PieChartRenderer. A value of zero indicates no hole (i.e. a pie), and any value greater than zero creates a hole by a fixed percentage of the pie. For example, a holePercentage of 0.5 removes 50% of the pie.

This can make pie charts look more modern and provide a space to place a number label if desired.

Map Viewer allows only two Arcade expressions in the Styles pane, so this web map cannot include all the calculated categories used in the JavaScript example. As a workaround, calculate additional categories into layer fields before styling them.
Item page
CodePen
Sandbox Download
Educational attainment is represented by donut charts sized by population.
Charts - donut with size
20 collapsed lines
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Charts - donut with size</title>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.2/"></script>
<style>
html,
body {
height: 100%;
margin: 0;
}
</style>
</head>
<body>
<arcgis-map item-id="5cfe1462277745d0818148e40605d2b0">
<arcgis-zoom slot="top-left"></arcgis-zoom>
<arcgis-expand slot="top-right">
<arcgis-legend></arcgis-legend>
</arcgis-expand>
</arcgis-map>
2 collapsed lines
</body>
</html>

API support

  1. Color only
  2. Size variable creators only supported for points
  3. Size variable creators not supported in 3D