ArcGIS Pro

Chart

In this topic

Summary

The Chart class defines an ArcGIS Pro chart. The class allows you to create different types of charts, including bar charts, line charts, scatter plots, scatter plot matrices, QQ plots, histograms, box plots, and data clocks. The class can also be used to define the chart title, axes, and other properties.

Discussion

Charts assist in presenting information about map features and the relationship between them in a visual, easy-to-understand manner. Charts may also be created for nonspatial tables and can show both additional information about the features on the map or the same information in a different way. Charts are complementary to maps in that they simply and visually convey information that would generally be summarized numerically or explored from tables. With a chart, it is easy to quickly compare features to gain insight into the functional relationship between the features and thereby visualize the distribution, trends, and patterns in the data that would otherwise be difficult to see.

You can only create and add charts to layer or tables in an ArcGIS Pro project and map. Charts cannot be visualized, rendered, or exported outside of the ArcGIS Pro application.

Syntax

Chart (name)

Parameter

Explanation

Data Type

name

The name of the chart. A chart must have a unique name per layer. This name is only used for identification; it is not displayed.

String

Properties

The statistical calculation applied to values that occur at the same value along the x-axis. Supported statistics are COUNT, SUM, MEAN, and MEDIAN. No aggregation means that each value will be plotted on the chart regardless of overlap or recurring values.

A second categorical field that adds a separate series or box for each unique value in the field.

splitCategoryAsMeanLine

Multiple-series box plots created with a split field can be displayed as mean lines or as side-by-side boxes. True displays split multiple series as mean lines, False displays split multiple series as side-by-side boxes.

The statistical calculation applied to values aggregated into each temporal bin. Supported statistics are COUNT, SUM, MEAN, and MEDIAN. No aggregation means that each value will be plotted on the chart regardless of overlap or recurring values.

The span of time that will be binned or aggregated together. Must be used in conjunction with timeIntervalUnit.

timeIntervalUnits

The time unit that corresponds to the timeIntervalSize. Valid options include SECONDS, MINUTES, HOURS, DAYS, WEEKS, MONTHS, and YEARS.

trimInCompleteTimeInterval

Determines whether incomplete time intervals at the start or end of the data span (depending on the timeAggregationType) will be removed from the chart. Incomplete intervals on a chart can cause misleading results in which the period in question is under or over reported due to a different amount of time in the interval. True indicates to trim these incomplete intervals, while False does not trim incomplete intervals.

The Chart class is not modified in any way. Rather the settings from the class are synced to the chart previously added to a layer.

After defining chart properties in the Chart class, the final step is typically to add the chart to a layer. Use the addToLayer method to accomplish this. However, you may wish to further modify the chart properties. Instead of starting from scratch with a new chart, you can modify the properties of the original Chart class, then use updateChart to sync any changes into the chart added to the layer. This will allow the changes you make to be presented in the Chart properties pane and chart view.

Use updateChart to sync chart property changes into a layer.

chart.addToLayer(myLayer)
# Further modification is necessary
chart.description = "Data from the U.S. Census Bureau"
chart.updateChart()

Code sample

Chart example

Add a Chart object to an arcpy.mpLayer object in order to add the chart to the layer.