recharts-line-chart
evilcharts/recharts-line-chartFreeComponent
Line chart component
Install it
npx shadcn@latest add https://evilcharts.com/r/recharts-line-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 CartesianGrid,20 Curve,21 Line as RechartsLine,22 LineChart as RechartsLineChart,23 XAxis as RechartsXAxis,24 YAxis as RechartsYAxis,25 type CurveProps,26} from "recharts";27import {28 type ChartConfig,29 ChartContainer,30 getColorsCount,31 getLoadingData,32 LoadingIndicator,33} from "@/registry/ui/recharts-chart";34import {35 ChartTooltip,36 ChartTooltipContent,37 type TooltipRoundness,38 type TooltipVariant,39} from "@/registry/ui/recharts-tooltip";40import {41 Brush,42 EvilBrush,43 useEvilBrush,44 type BrushProps,45 type EvilBrushRange,46} from "@/registry/ui/recharts-brush";47import {48 ChartLegend,49 ChartLegendContent,50 type ChartLegendVariant,51} from "@/registry/ui/recharts-legend";52import { ChartDot, type DotVariant } from "@/registry/ui/recharts-dot";53import { motion, useReducedMotion } from "motion/react";5455// Constants56const STROKE_WIDTH = 0.8; // default series stroke — <Line strokeWidth> overrides it57const LOADING_LINE_DATA_KEY = "loading";58const LOADING_ANIMATION_DURATION = 2000; // in milliseconds59const 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 RechartsLine>["type"];63type LineDotProp = ComponentProps<typeof RechartsLine>["dot"];64type LineActiveDotProp = ComponentProps<typeof RechartsLine>["activeDot"];65type StrokeVariant = "solid" | "dashed" | "animated-dashed";6667/**68 * Direction of the custom motion.dev intro reveal. Recharts' own line animation69 * is permanently disabled (it drew the line after the dots had already popped70 * in) — these reveals replace it.71 *72 * NOTE: a reveal is a per-frame animated SVG mask, so it is heavier than a73 * static chart. `"none"` opts out entirely; it is also what a device with the74 * OS "reduce motion" preference falls back to automatically.75 */76type LineAnimationType = "none" | "left-to-right" | "right-to-left" | "center-out" | "edges-in";77type RevealAnimationType = Exclude<LineAnimationType, "none">;7879// ─────────────────────────────────────────────────────────────────────────────80// … 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 |
