Line chart
Display data trends as connected points with the LineChart component.
A line chart shows data as line-connected dots. Line charts can display either multiple measures as individual lines or a single measure split by one attribute into multiple lines with points intersecting attribute values. Use it to show how a measure changes over time or across a series of stages, for example, the monthly sales of a product.

Buckets
| Prop | Required | Takes | What it does |
|---|---|---|---|
measures | Yes | One or more measures | Draws one line per measure. |
trendBy | No | One attribute | Slices the lines along the X axis, one point per attribute value. |
segmentBy | No | One attribute | Splits the measure into one line per attribute value. Use it with a single measure, plus an optional threshold measure (see thresholdMeasures). |
filters | No | Filters | Limits the data the line chart shows. |
Sorting
LineChart applies no default sorting. To sort the data, pass sort items in the sortBy prop. 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 lines, one per measure or per segmentBy value. |
legend | Whether the legend shows and where. The legend shows only with two or more lines or with segmentBy. |
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. |
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 line across missing values. |
lineShape (beta) | How the line runs between data points: "linear" (default), "spline" for a smooth curve, or "stepped" for steps. |
lineStyleMapping (beta) | Dash style and width per line. 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 segmentBy. |
thresholdMeasures, thresholdExcludedMeasures | thresholdMeasures takes the local identifier of one measure that isn’t drawn but sets the line style: where its value is empty or 0, the other lines are dashed. Lines of the measures in thresholdExcludedMeasures stay solid. With segmentBy, thresholdExcludedMeasures has no effect. |
enableCompactSize | Hides axis labels and axis names in small containers. Has no effect with zoomInsight. |
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. |
Forecast and anomalies
LineChart can ask GoodData to forecast the next values of a measure and to find anomalies in it. Both work on a
chart with one line: one measure, one date attribute in trendBy, and no segmentBy.
| Prop | Takes | What it does |
|---|---|---|
forecastConfig | forecastPeriod (number of periods), confidenceLevel (between 0 and 1, for example 0.95), seasonal | Continues the line with a dashed forecast and a shaded confidence band. |
outliersConfig | sensitivity ("low", "medium", or "high") | Highlights the points that GoodData detects as anomalies and adds an Anomalies legend item. |
The anomalies option in config styles those points: color (red by default) and size ("small",
"medium", or "big").
<LineChart
measures={[Md.$FranchiseFees]}
trendBy={Md.DateMonth.Short}
forecastConfig={{ forecastPeriod: 3, confidenceLevel: 0.95, seasonal: false }}
outliersConfig={{ sensitivity: "medium" }}
/>
GoodData Cloud calls these smart functions; see Use Smart Functions.
Limits
- A line chart renders up to 10,000 lines and up to 10,000
trendByvalues. With more, the chart shows an error andonErrorreceives aDataTooLargeToDisplaySdkError. Filter the data to fit.
Structure
import "@gooddata/sdk-ui-charts/styles/css/main.css";
import { LineChart } from "@gooddata/sdk-ui-charts";
<LineChart
measures={<measures>}
config={<chart-config>}
…
/>
Example
import "@gooddata/sdk-ui-charts/styles/css/main.css";
import { LineChart } from "@gooddata/sdk-ui-charts";
import * as Md from "./catalog.js";
const style = { height: 300 };
<div style={style}>
<LineChart
measures={[Md.$FranchiseFees]}
trendBy={Md.DateMonth.Short}
/>
</div>
Props
| Prop | Type | Required | Description | Inherited from |
|---|---|---|---|---|
forecastConfig | IForecastConfig | No | (Beta) Enter the forecast configuration to apply to the chart data. | — |
outliersConfig | IOutliersConfig | No | (Beta) Enter the outliers configuration to apply to the chart data. | — |
measures | AttributesMeasuresOrPlaceholders | Yes | Specify one or more measures whose values will be displayed on the line chart. | ILineChartBucketProps |
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. | ILineChartBucketProps |
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. | ILineChartBucketProps |
segmentBy | AttributeOrPlaceholder | No | Specify single attribute whose values will be used to segment the measure values. | ILineChartBucketProps |
sortBy | SortsOrPlaceholders | No | Specify how to sort the data to chart. | ILineChartBucketProps |
trendBy | AttributeOrPlaceholder | No | Specify single attribute whose values will be used to slice the lines along the X axis. | ILineChartBucketProps |
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 trends over time with filled areas using the AreaChart component.
Combine bars and lines in a single visualization with the ComboChart component.
Display vertical bar comparisons with the ColumnChart 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.