AniUI

Area Chart

Visualize data trends with filled areas under lines. Built on react-native-svg.

Default

app/chart-demo.tsx
import { AreaChart } from "@/components/ui/area-chart";

const data = [
  { label: "Jan", value: 186 },
  { label: "Feb", value: 305 },
  { label: "Mar", value: 237 },
  { label: "Apr", value: 173 },
  { label: "May", value: 409 },
  { label: "Jun", value: 214 },
];

export function MyChart() {
  return <AreaChart data={data} color="#2563eb" />;
}

Installation

npx @aniui/cli add area-chart

Stacked

Multiple overlapping area series.

import { AreaChart } from "@/components/ui/area-chart";

const series = [
  {
    data: [
      { label: "Jan", value: 186 },
      { label: "Feb", value: 305 },
      { label: "Mar", value: 237 },
    ],
    color: "#2563eb",
  },
  {
    data: [
      { label: "Jan", value: 120 },
      { label: "Feb", value: 210 },
      { label: "Mar", value: 180 },
    ],
    color: "#f97316",
  },
];

export function StackedAreaChart() {
  return <AreaChart data={series[0].data} series={series} />;
}

Step

Stepped area chart with sharp transitions.

import { AreaChart } from "@/components/ui/area-chart";

export function StepAreaChart() {
  return <AreaChart data={data} curved={false} />;
}

Gradient

Custom gradient fill with adjustable opacity.

import { AreaChart } from "@/components/ui/area-chart";

export function GradientAreaChart() {
  return <AreaChart data={data} color="#8b5cf6" fillOpacity={0.5} />;
}

Interactive

Area chart with tooltip on data point press.

import { AreaChart } from "@/components/ui/area-chart";
import { ChartTooltip } from "@/components/ui/chart-tooltip";

// The AreaChart component supports press interactions
// Wrap with a tooltip for interactive data display
export function InteractiveAreaChart() {
  return <AreaChart data={data} color="#2563eb" showGrid />;
}

With Axes

Area chart with X/Y axis labels and grid lines.

import { AreaChart } from "@/components/ui/area-chart";

export function AreaChartWithAxes() {
  return (
    <AreaChart
      data={data}
      showGrid
      showLabels
      color="#2563eb"
      height={220}
    />
  );
}

Props

PropTypeDefault
data
{ label: string; value: number }[]
height
number
200
color
string
"#2563eb"
fillOpacity
number
0.3
showGrid
boolean
true
showLabels
boolean
false
curved
boolean
true
series
{ data, color }[]
className
string

Source

components/ui/area-chart.tsx
// See full source: components/ui/area-chart.tsx
// Install with: npx @aniui/cli add area-chart
// Dependencies: react-native-svg