recharts-area-chart
evilcharts/recharts-area-chartFreeComponent
Area chart component
Install it
npx shadcn@latest add https://evilcharts.com/r/recharts-area-chart.jsonSource
1"use client";23import {4 Children,5 createContext,6 isValidElement,7 use,8 useCallback,9 useId,10 useMemo,11 useRef,12 useState,13 type ComponentProps,14 type FC,15 type ReactElement,16 type ReactNode,17} from "react";18import {19 axisValueToPercentFormatter,20 type ChartConfig,21 ChartContainer,22 getColorsCount,23 getLoadingData,24 LoadingIndicator,25} from "@/registry/ui/recharts-chart";26import {27 Area as RechartsArea,28 AreaChart as RechartsAreaChart,29 CartesianGrid,30 XAxis as RechartsXAxis,31 YAxis as RechartsYAxis,32} from "recharts";33import {34 ChartTooltip,35 ChartTooltipContent,36 type TooltipRoundness,37 type TooltipVariant,38} from "@/registry/ui/recharts-tooltip";39import {40 Brush,41 EvilBrush,42 useEvilBrush,43 type BrushProps,44 type EvilBrushRange,45} from "@/registry/ui/recharts-brush";46import {47 ChartLegend,48 ChartLegendContent,49 type ChartLegendVariant,50} from "@/registry/ui/recharts-legend";51import { ChartDot, type DotVariant } from "@/registry/ui/recharts-dot";52import { motion, useReducedMotion } from "motion/react";5354// Constants55const STROKE_WIDTH = 0.8; // default series stroke — <Area strokeWidth> overrides it56const LOADING_AREA_DATA_KEY = "loading";57const LOADING_ANIMATION_DURATION = 2000; // in milliseconds58const STACK_ID = "evil-stacked";59const REVEAL_DURATION = 1; // intro wipe length, in seconds60const REVEAL_EASE: [number, number, number, number] = [0, 0.7, 0.5, 1]; // intro wipe easing6162type CurveType = ComponentProps<typeof RechartsArea>["type"];63type AreaDotProp = ComponentProps<typeof RechartsArea>["dot"];64type AreaActiveDotProp = ComponentProps<typeof RechartsArea>["activeDot"];65type AreaVariant = "gradient" | "gradient-reverse" | "solid" | "dotted" | "lines" | "hatched";66type StrokeVariant = "solid" | "dashed" | "animated-dashed";67type StackType = "default" | "expanded" | "stacked";6869/**70 * Direction of the custom motion.dev intro reveal. Recharts' own area animation71 * is permanently disabled (it drew the line after the dots had already popped72 * in) — these reveals replace it.73 *74 * NOTE: a reveal is a per-frame animated SVG mask, so it is heavier than a75 * static chart. `"none"` opts out entirely; it is also what a device with the76 * OS "reduce motion" preference falls back to automatically.77 */78type AreaAnimationType = "none" | "left-to-right" | "right-to-left" | "center-out" | "edges-in";79type RevealAnimationType = Exclude<AreaAnimationType, "none">;8081// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from EvilCharts
All 271 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| echarts-area-chartecharts-area-chart | EvilCharts | Components | Free | 2 deps | |
| echarts-bar-chartecharts-bar-chart | EvilCharts | Components | Free | 2 deps | |
| echarts-brushecharts-brush | EvilCharts | Components | Free | 1 dep | |
| echarts-chartecharts-chart | EvilCharts | Components | Free | 1 dep | |
| echarts-composed-chartecharts-composed-chart | EvilCharts | Components | Free | 2 deps | |
| echarts-dotecharts-dot | EvilCharts | Components | Free | 1 dep | |
| echarts-legendecharts-legend | EvilCharts | Components | Free | no deps | |
| echarts-line-chartecharts-line-chart | EvilCharts | Components | Free | 2 deps |
