Skip to content

Area Chart

AreaChart is the dedicated v2 surface for filled trend charts. It shares the same data model and interaction primitives as LineChart, but defaults to an area fill.

Basic Area

import { AreaChart } from "react-native-chart-kit/v2";

const data = [
  { date: "Jan 01", price: 72 },
  { date: "Jan 03", price: 138 },
  { date: "Jan 08", price: 91 },
  { date: "Jan 15", price: 166 },
  { date: "Jan 24", price: 118 },
  { date: "Feb 01", price: 202 }
];

export function PipelineChart() {
  return (
    <AreaChart
      data={data}
      xKey="date"
      yKey="price"
      curve="monotone"
      width={360}
      height={240}
    />
  );
}

Area Fill

Use areaFill to tune fill opacity. You can also pass area to LineChart when a product uses line and area variants from the same component wrapper.

const data = [
  { date: "Jan", price: 42 },
  { date: "Feb", price: 96 },
  { date: "Mar", price: 58 },
  { date: "Apr", price: 132 },
  { date: "May", price: 84 },
  { date: "Jun", price: 158 }
];

<LineChart
  area
  areaFill={{ fromOpacity: 0.32, toOpacity: 0.05 }}
  data={data}
  xKey="date"
  yKey="price"
  curve="monotone"
  width={360}
  height={240}
/>;

Use areaFill on the chart for a shared fill style, or per series when each series needs its own colors or opacity.

Threshold Area

Threshold coloring clips the rendered path and area fill above or below a y value. Raw points are unchanged.

const data = [
  { month: "Jan", attainment: 62 },
  { month: "Feb", attainment: 138 },
  { month: "Mar", attainment: 74 },
  { month: "Apr", attainment: 151 },
  { month: "May", attainment: 89 },
  { month: "Jun", attainment: 122 },
  { month: "Jul", attainment: 55 },
  { month: "Aug", attainment: 164 },
  { month: "Sep", attainment: 96 },
  { month: "Oct", attainment: 145 },
  { month: "Nov", attainment: 78 },
  { month: "Dec", attainment: 172 }
];

<AreaChart
  data={data}
  xKey="month"
  series={[
    {
      yKey: "attainment",
      label: "Attainment",
      threshold: {
        y: 100,
        aboveColor: "#16a34a",
        belowColor: "#dc2626",
        areaAboveColor: "#16a34a",
        areaBelowColor: "#dc2626",
        areaOpacity: 0.16
      }
    }
  ]}
  referenceLines={[{ y: 100, label: "Plan", strokeDasharray: [5, 4] }]}
  width={360}
  height={240}
/>;

Dense Area Charts

For long time series, use the same viewport, scrolling, and decimation options as LineChart.

<AreaChart
  data={largeData}
  xKey="timestamp"
  yKey="price"
  scrollable
  visiblePoints={30}
  initialIndex="end"
  showDots={false}
  decimation={{ maxPoints: 700 }}
  yAxisLabelWidth="stable"
  width={360}
  height={260}
/>

Props

AreaChart

AreaChart accepts the same prop surface as LineChart and renders with area fill enabled by default.

PropTypeDescription
dataTData[]Object-row source data for the chart.
xKeykeyof TDataRow key used for the x-axis value.
yKeykeyof TDataSingle row key used for y values when series or yKeys is not provided.
yKeysArray<keyof TData>Multiple row keys rendered as separate series with default styling.
seriesLineChartSeries<TData>[]Full per-series configuration, including labels, colors, stroke, dots, thresholds, and area fill.
widthnumberOuter chart width in pixels.
heightnumberOuter chart height in pixels.
themeChartKitThemeMode or CartesianChartThemeTheme mode or inline theme tokens for this chart.
presetCartesianChartPresetValueBuilt-in or registered preset name used to seed chart colors and typography.
scrollablebooleanEnables a horizontal scroll viewport for long data sets.
visiblePointsnumberNumber of points visible in the viewport when scrollable is enabled.
initialIndexChartViewportInitialIndexInitial scroll/window position, such as "start" or "end".
viewportLineChartViewportConfigControlled visible data window for scroll, pan, zoom, or range selector flows.
onViewportChange(event) => voidCalled when viewport state changes from the main plot or range selector.
viewportInteractionboolean or LineChartViewportInteractionConfigEnables and configures one-finger pan and pinch zoom for the viewport.
rangeSelectorboolean or LineChartRangeSelectorConfigAdds a mini-chart range selector below the main plot.
decimationfalse, "auto", number, or LineChartDecimationConfigControls rendered path simplification for dense series.
curveLineCurveCurve interpolation used for line and area paths.
connectNullsbooleanConnects defined points across null or missing y values.
areabooleanInherited from LineChartProps; AreaChart renders with area fill enabled.
areaFillLineChartAreaFillConfigShared area fill opacity, gradient, or color configuration.
showDotsbooleanShows or hides all point markers.
dotsboolean or LineChartDotConfigConfigures default point marker visibility, size, shape, and color.
renderDot(props) => ReactNodeCustom renderer for ordinary point markers.
selectedIndexnumberControlled selected data index.
defaultSelectedIndexnumberInitial uncontrolled selected data index.
activeDotboolean or LineChartDotConfigConfigures the marker shown for the selected point.
renderActiveDot(props) => ReactNodeCustom renderer for the selected point marker.
interactionLineChartInteraction<TData>Selection/scrub interaction mode and callbacks.
crosshairboolean or LineChartCrosshairConfigShows and configures the selected-point crosshair.
renderCrosshair(props) => ReactNodeCustom renderer for the crosshair.
tooltipboolean or LineChartTooltipConfigShows and configures selected-point tooltip content and placement.
renderTooltip(props) => ReactNodeCustom renderer for selected-point tooltip content.
referenceLinesLineChartReferenceLineConfig[]Horizontal reference lines drawn across the plot.
referenceBandsLineChartReferenceBandConfig[]Horizontal reference bands drawn behind the series.
showHorizontalGridLinesbooleanShows or hides horizontal grid lines.
showVerticalGridLinesbooleanShows or hides vertical grid lines.
legendboolean or LineChartLegendConfigShows and configures the chart legend.
labelStrategyLineChartLabelStrategyControls x-axis label density and layout.
labelRotationnumberRotation angle for x-axis labels when using rotated labels.
labelMinGapnumberMinimum gap used by automatic x-axis label skipping.
edgeLabelPolicyLineChartEdgeLabelPolicyControls how first and last x-axis labels are shifted, hidden, or shown.
yDomainNumericDomainInputOverrides or constrains the computed y-axis domain.
yAxisLabelWidthLineChartYAxisLabelWidthFixed, automatic, or stable width for y-axis labels.
axisLabelAnimationboolean or LineChartAxisLabelAnimationConfigAnimates y-axis label changes during viewport updates.
formatXLabel(value, index) => stringFormats x-axis labels and selected x labels.
formatYLabel(value) => stringFormats y-axis labels, selected values, and tooltip values.
rendererLineChartRendererRenderer implementation used for SVG-compatible primitives.
idstringStable chart id used for internal ids and coordinated selection scope.
debugLayoutbooleanRenders layout debug rectangles in development.
onLayoutDebug(model) => voidReceives computed layout debug geometry.
accessibilityLabelstringOverrides the generated accessible chart summary.
testIDstringTest identifier applied to the chart surface.