Join our Discord community
Area chart

Percentage Area Chart

Percentage-based stacked area visualization with three data series. Perfect for React applications showing proportional data with Next.js and TypeScript.

Powered by

Loading component...

Installation

npx shadcn@latest add https://www.shadcn.io/registry/area-chart-07.json
npx shadcn@latest add https://www.shadcn.io/registry/area-chart-07.json
pnpm dlx shadcn@latest add https://www.shadcn.io/registry/area-chart-07.json
bunx shadcn@latest add https://www.shadcn.io/registry/area-chart-07.json

Features

  • Expanded stacking with stackOffset="expand" normalizing values to 100% at each point
  • Three data series showing desktop, mobile, and other traffic sources
  • Percentage visualization displaying proportional relationships rather than absolute values
  • Variable opacity styling with different fill opacity levels for visual hierarchy
  • TypeScript support with complete type definitions for multi-series percentage data
  • shadcn/ui integration using Chart components and three-color design tokens

Use Cases

This free open source React component works well for:

  • Market share analysis - Display relative proportions of different segments built with Next.js
  • Budget allocation - Show spending distribution across categories using TypeScript and Tailwind CSS
  • Resource utilization - Visualize percentage usage of system resources over time
  • Survey data - Present response distributions as proportional areas

API Reference

ChartAreaStackedExpand

PropTypeDefaultDescription
classNamestring-Additional CSS classes for the card container

Chart Configuration

The component supports three data series with different styling:

const chartConfig = {
  desktop: {
    label: "Desktop",
    color: "var(--chart-1)",
  },
  mobile: {
    label: "Mobile",
    color: "var(--chart-2)",
  },
  other: {
    label: "Other",
    color: "var(--chart-3)",
  },
} satisfies ChartConfig

Implementation Notes

  • Uses stackOffset="expand" to normalize all stacks to 100% height
  • Areas render in specific order: other (bottom), mobile (middle), desktop (top)
  • Other area uses lower opacity (0.1) for subtle background presence
  • Chart height normalized regardless of actual data values
  • Perfect for showing changing proportions over time rather than absolute growth