Area chart
Display trends over time with filled areas using the AreaChart component.
An area chart shows data as an area under a line intersecting dots. It can display either multiple measures as different areas or a single measure split by one attribute into multiple areas with points intersecting attribute values. Use it to show how parts add up to a whole over time, for example, the market share of several companies in an industry.
Areas stack by default. Alternatively, the areas can overlap if { stackMeasures: false } is set in the chart config.

Buckets
| Prop | Required | Takes | What it does |
|---|---|---|---|
measures | Yes | One or more measures | Draws one area per measure. |
viewBy | No | One or two attributes | Slices the areas along the X axis. With two attributes, the second one splits the first measure into areas, as stackBy does, and the areas overlap instead of stacking. The chart then ignores the other measures and stackBy. Attributes after the second are ignored. |
stackBy | No | One attribute | Splits the measure into one area per attribute value. Works only with a single measure and at most one viewBy attribute. |
filters | No | Filters | Limits the data the area chart shows. |
Sorting
AreaChart applies no default sorting. To sort the data, pass sort items in the sortBy prop. To sort the viewBy values by the total of the stacked areas, use an attribute area sort (newAttributeAreaSort) on the viewBy attribute. See Sort items.
Configuration
Pass these options in the config prop. See Chart configuration for details.
| Option | What it changes |
|---|---|
colors, colorPalette, colorMapping | Colors of the areas, one per measure or per stackBy value. |
chartFill | type sets how the areas are filled: "solid", "pattern", or "outline". The line on top of each area keeps its solid color. |
legend | Whether the legend shows and where. |
xaxis, yaxis | Axis visibility, labels, label rotation, and axis name. yaxis.min and yaxis.max set the Y axis range. |
secondary_yaxis | measures takes the local identifiers of the measures to show on a second Y axis on the right. The other options work as in yaxis. |
stackMeasuresToPercent | true stacks the areas on the primary Y axis to 100%, so each area shows its share of the total. Takes precedence over stackMeasures. Ignored with two viewBy attributes. |
dataLabels | visible shows or hides the labels. style: "backplate" adds a background behind them. |
dataPoints | visible shows or hides the dot at each data point. |
grid | enabled shows or hides the horizontal grid lines. |
continuousLine | enabled: true connects the areas across missing values. The areas then overlap instead of stacking. Ignored when stackMeasures is true. |
lineShape (beta) | How the top line of each area runs between data points: "linear" (default), "spline" for a smooth curve, or "stepped" for steps. |
lineStyleMapping (beta) | Dash style and width of the top line of each area. Each item has an id, lineStyle ("solid", "dashed", or "dotted"), and lineWidth (1–4 pixels, default 3). The id is the measure local identifier, or the attribute element URI with stackBy. |
zoomInsight | true lets you drag across the chart to zoom in on the X axis. Hold Shift while dragging to pan. |
separators | Thousands and decimal separators in the number format. |
Limits
- An area chart renders up to 10,000 areas and up to 10,000
viewByvalues. With more, the chart shows an error andonErrorreceives aDataTooLargeToDisplaySdkError. Filter the data to fit. - A measure shown as a percentage (
computeRatio) stays a percentage only when the chart uses a single measure. With more measures, the chart shows raw values. See Show a measure as a percentage.
Structure
import "@gooddata/sdk-ui-charts/styles/css/main.css";
import { AreaChart } from "@gooddata/sdk-ui-charts";
<AreaChart
measures={<measures>}
config={<chart-config>}
…
/>
Example
import "@gooddata/sdk-ui-charts/styles/css/main.css";
import { AreaChart } from "@gooddata/sdk-ui-charts";
import * as Md from "./catalog.js";
const style = { height: 300 };
<div style={style}>
<AreaChart
measures={[Md.$FranchiseFees]}
viewBy={Md.DateMonth.Short}
/>
</div>
Props
| Prop | Type | Required | Description | Inherited from |
|---|---|---|---|---|
measures | AttributesMeasuresOrPlaceholders | Yes | Specify one or more measures to display on area chart. | IAreaChartBucketProps |
backend | IAnalyticalBackend | No | Analytical backend, from which the chart will obtain data to visualize If you do not specify instance of analytical backend using this prop, then you MUST have BackendProvider up in the component tree. | IBucketChartProps |
config | IChartConfig | No | Configure chart’s behavior and appearance. | ICommonChartProps |
drillableItems | ExplicitDrill[] | No | Configure drillability; e.g. which parts of the visualization can be interacted with. | IVisualizationProps |
ErrorComponent | ComponentType<IErrorProps> | No | React component to display in the event when there is an error with either obtaining the data from backend or with the data itself. | IVisualizationProps |
execConfig | IExecutionConfig | No | Execution configuration, will provide the execution with necessary config before initiating execution. | ICommonChartProps |
exportTitle | string | No | Set title to use for exported files. | IVisualizationProps |
filters | NullableFiltersOrPlaceholders | No | Specify filters to apply on the data to chart. | IAreaChartBucketProps |
height | number | No | Set height of the chart (in pixels). | ICommonChartProps |
LoadingComponent | ComponentType<ILoadingProps> | No | React component to display while loading data from the backend. | IVisualizationProps |
locale | string | No | Set Locale for visualization localization. | IVisualizationProps |
onDataView | OnDataView | No | (Alpha) Called when the visualization loads a DataView, i.e. it receives data from the backend. | IVisualizationCallbacks |
onDrill | OnFiredDrillEvent | No | Called when user triggers a drill on a visualization. | IVisualizationCallbacks |
onError | OnError | No | Called when an error occurs while loading data for the visualization. | IVisualizationCallbacks |
onExportReady | OnExportReady | No | Called when the visualization is ready to be exported. | IVisualizationCallbacks |
onLegendReady | OnLegendReady | No | Called when legend is rendered. | IChartCallbacks |
onLoadingChanged | OnLoadingChanged | No | Called when loading status of the visualization changes - vis starts or stops loading | IVisualizationCallbacks |
placeholdersResolutionContext | any | No | Resolution context for composed placeholders. | IAreaChartBucketProps |
sortBy | SortsOrPlaceholders | No | Specify how to sort the data to chart. | IAreaChartBucketProps |
stackBy | AttributeOrPlaceholder | No | Specify attribute to stack by. This is only applicable if you specify at most single viewBy attribute. | IAreaChartBucketProps |
viewBy | AttributeOrPlaceholder | AttributesOrPlaceholders | No | Specify attributes to slice and stack the area chart. | IAreaChartBucketProps |
width | number | No | Set width of the chart (in pixels). | ICommonChartProps |
workspace | string | No | Identifier of analytical workspace, from which the chart will obtain data to visualize. If you do not specify workspace identifier, then you MUST have WorkspaceProvider up in the component tree. | IBucketChartProps |
Related
Display data trends as connected points with the LineChart component.
Display vertical bar comparisons with the ColumnChart component.
Combine bars and lines in a single visualization with the ComboChart component.
Configure chart appearance, axes, legends, colors, and data labels.
Shared behavior of GoodData.UI visual components — responsive sizing, the style and data props model, and the visualization lifecycle callbacks.