The Chart widget displays quantitative attributes from a data source as a graph. The widget allows users to visualize possible patterns and trends from raw data.
Currently, you can choose from bar, column, line, area, and pie charts, scatter plots, histograms, and gauges. Depending on the category type that you choose when configuring the widget, the chart can represent the statistic value of fields for aggregated groups or the statistics of all values for specific fields.
Bar, column, line, and area charts are all series charts, which rely on a series of data to render the display. A data series is a set of data that is displayed on a chart. You can think of a series as an array of values based on the attribute. Each instance in the array is a data point. When plotted on a chart, each data point has a shape. One or more series can be displayed at a time in a series chart. For example, a chart can show the total number of occupied and vacant housing units in each U.S. state. The number of occupied units in each state is a series, and the number of vacant units is another series. Each population of a state is a data point in that series.
Pie charts express part-to-whole relationships in data. Each slice represents one component and all slices added together equal the whole. Each slice is a data point that illustrates numerical proportion to the whole.
Scatter plots use points plotted on a graph to show the relationship between two variables.
Histograms visually summarize the distribution of continuous numeric variables by measuring the frequency at which certain values appear in data sets. The Chart widget's histograms classify data into various bins, which are ranges between intervals, and show the number data points in each bin. Histograms are appropriate for showing distribution.
A gauge displays a single metric in the context of minimum and maximum values. Gauges are useful for displaying progress toward goals or numerical targets.
Examples
Use this widget to support app design requirements such as the following:
- You want to show statistic graphics for a feature layer.
- You want to analyze and visualize data patterns.
- You want to compare feature attributes graphically.
Usage notes
The widget requires a data source. You can use the chart widget on a page with or without a displayed map. After selecting a data source, you select a chart template to start with a specific chart type.
The data source for a chart can be one of the following:
- Operational layers, including a feature layer or scene layer in an existing map or added from a service.
- Tables from a map, including a related table.
- Output data source of another widget, such as query result of the Query widget.
To create a histogram chart or calculate a median for any chart, the connected data source must have percentile-continuous
or percentile-discrete
supported as a statistics type. Layers that support percentiles include the supports
property as true in the advanced
layer object.
Learn more about layer properties
Settings
The Chart widget includes the following settings:
-
Data source—Select source data with attributes to analyze in the Chart widget. In the data view settings, you can filter the data to restrict what appears in the widget, sort the data to display features in a particular order, or limit the number of features.
-
Chart type—Select a chart type using a template to start with that matches how you want to present the data analysis. If the connected data source contains a chart, you can create a chart from an existing chart.
- Use a bar chart to summarize and compare categorical data. A column chart is a vertical bar chart.
- Use a line chart to visualize change over a continuous range, such as time or distance. An area chart has a pattern similar to line charts but is ideal for indicating a change among different datasets to show how values develop over time.
- Use a pie chart to illustrate proportions for categorical or nominal data, either in a sliced pie or donut style.
- Use a scatter plot to show the relationship between two sets of data by plotting points on a graph.
- Use a gauge to show the relationship between a measurement and minimum and maximum values.
-
Data (Column, bar, line, area, and pie charts)—Define how to generate the data series for the chart by choosing a category type and configuring which data attributes to visualize and how to present them.
-
Category type—Options vary based on category.
-
By group—Display values by category, depicting statistical values of one or multiple fields for each category.
-
Category field—Define the attribute field from which chart categories are generated. All fields from the connected data source display in the drop-down menu. You can scroll or search for fields by name. Click a field to choose it.
-
Parse numeric category—This setting appears for line charts when the category field is a number field. Choose to render the category axis with discrete values, meaning the values in the data, or continuous values, meaning a range between the minimum and maximum values in the field.
-
Statistics—Calculate the statistical values for the specified number fields. Methods include count, sum, average, minimum, maximum, median, and no aggregation.
-
Split by field—Optionally, split the category field by another field. If you define a split-by field, the data from the category field is split into multiple data series (that is, one series for each unique value in the split-by field).
-
Time binning options—The following settings appear for bar, column, line, and area charts when you make the category field a date field:
- Interval—Set the interval of the time bins. Bins are ranges of continuous numeric values and are used to sort data. For example, if you define the interval as one year, the x-axis is divided into equal one-year intervals and the chart shows the data points that fall within each one-year period.
- Interval alignment—Choose to align the intervals to either the first data point or the last data point. For example, if the first data point has a date value of January 1, 2000, and you define the interval as 10 years and choose Snap to the first data point, the first interval on the graph is January 1, 2000 to December 31, 2009.
- Empty bins—Choose what to do for intervals of time in which no data point exists. You can represent empty bins as breaks in the line, treat them as having a value of zero, or ignore them and have the line connect the non-empty bins.
- Trim incomplete interval—Turn on this setting to remove any intervals from the graph that are incomplete. An example of an incomplete interval would be a one-year interval that starts on January 1, 2000, but the final data point is February 1, 2000, meaning there is not enough space for a full one-year interval at that end of the graph.
-
Number Fields—Select one or multiple fields to analyze. All number fields from the connected data source display in the drop-down menu. You can scroll or search for fields. You can use the Show selection button to limit the drop-down menu to selected fields, or you can clear your selection with the Clear selection button.
-
-
By field—Display attribute values as charts, depicting statistical values of all features or records for a specified field or fields.
- Statistics—Calculate the statistical values for the specified number fields. Methods include sum, average, minimum, maximum, and median.
- Number Fields—Select one or multiple fields for which to calculate the statistics. All number fields from the connected data source display in the drop-down menu. You can scroll or search for fields. You can use the Show selection button to limit the drop-down menu to selected fields, or you can clear your selection with the Clear selection button.
-
-
Sort by—Sort the chart by values or category name, in ascending or descending order.
-
Maximum categories (available when you choose By group for the Category type)—Specify the maximum categories to display in the chart.
-
-
Data (scatter plots)—Define how to generate the scatter plot.
-
Variables—Choose which numerical attributes to display on the axes. Select a value for X-axis number and Y-axis number.
-
Statistics—Turn on Show linear trend to display a trend line, also known as a line of best fit, on the scatter plot. The trend line models the linear relationship between the data points. The r2 value, which also displays, quantifies the strength of the relationship between the variables on the two axes. You can change the color, stroke type, and width of the trend line.
-
Hover label—Display hover labels when the user points to data points.
-
Symbol—Customize the size and color of the data point symbols.
- Use color from layer—Use the symbology from the connected layer to color the scatter plot. This is the default option. If the layer does not have applicable colors, the widget applies a default color.
- Custom color—Choose a custom color with the color picker. You can also change the outline color, outline stroke type, and outline width of the data point symbols.
-
-
Data (histograms)—Define how to generate the histogram.
-
Variables—Choose a numeric field from the connected data source and, optionally, apply a transformation. To generate a histogram, the data source must have at least one numeric field. You can choose to apply a logarithmic or square root transformation. Transformations are commonly used to deal with skewed data.
-
Bins—Define the number of bins. Bins are ranges of continuous numeric values and are used to sort data. For example, if you define the number of bins as 10, the numeric field's range is divided into 10 equal-sized intervals, and the chart shows the count of values that fall within each interval. You can change the color of the bins and the color, dash type, and width of the bin outlines.
-
Color—Choose a method for setting the color of the histogram.
- Use color from layer—Use the symbology from the connected layer to color the histogram. This is the default option. If the layer does not have applicable colors, the widget applies a default color.
- Custom color—Choose a custom color with the color picker. You can also change the symbol style.
-
Data label—Display count labels on top of each bin.
-
Hover label—Display hover labels when the user points to bins.
-
Statistic graph—Add overlays showing the mean, median, normal distribution, or standard deviation of the data. You can change the color, dash type, and width of each overlay.
-
-
Data (gauges)—Define the display value, minimum value, and maximum value on the gauge.
- Display value—The measurement indicated by the gauge. You can calculate this value with any of the five operators: Count, Mean, Sum, Max, or Min. The Number Fields drop-down menu lists all number fields from the connected data source.
- Minimum value and Maximum value—The two values that define the range represented by the gauge. Click Fixed to enter specific values, or click Statistics to calculate the values using one of the five operators and one of the number fields from the connected data source.
-
Series (available for column, bar, line, and area charts)—Change the stacking type, symbols, and labels of the data series. The data series is the set of data that is used to populate the chart.
-
Stacking—Group series of the same type side by side, stacked, or 100 percent stacked.
-
Data label—Display and align the data label on each series symbol.
- Optimize label display—This setting appears for stacked and 100 percent stacked charts. If you turn on this setting, the widget displays or hides data labels automatically based on the amount of available space.
-
Hover label—Display hover labels when the user points to chart elements.
-
Color—Choose a method for coloring the chart.
- Use color from layer—Use the symbology from the connected layer to color the chart. This is the default option. If the layer does not have applicable colors, the widget applies a default color.
- Custom color—Choose a custom color with the color picker. You can also change the series symbol style. For line and area charts, you can display points for each statistic value and edit the point symbol style.
-
Hide empty series—Hide any series that contains no data points from the chart and the legend.
-
-
Axes—For applicable charts, customize the properties of the x and y axes.
-
X axis
-
Axis title—Provide a title for the x axis.
-
Axis label—Include value labels on the x axis.
- Character limit—Specify how many characters to display for each category label.
- Alignment
-
-