recharts-radial-chart
evilcharts/recharts-radial-chartFreeComponent
Radial bar chart component with full and semi-circle variants
Install it
npx shadcn@latest add https://evilcharts.com/r/recharts-radial-chart.jsonSource
1"use client";23import {4 PolarAngleAxis,5 RadialBar as RechartsRadialBar,6 RadialBarChart as RechartsRadialBarChart,7 Sector,8 type SectorProps,9} from "recharts";10import {11 createContext,12 use,13 useCallback,14 useEffect,15 useId,16 useMemo,17 useState,18 type ComponentProps,19 type ReactNode,20} from "react";21import {22 ChartTooltip,23 ChartTooltipContent,24 type TooltipRoundness,25 type TooltipVariant,26} from "@/registry/ui/recharts-tooltip";27import {28 type ChartConfig,29 ChartContainer,30 getColorsCount,31 LoadingIndicator,32} from "@/registry/ui/recharts-chart";33import {34 ChartLegend,35 ChartLegendContent,36 type ChartLegendVariant,37} from "@/registry/ui/recharts-legend";38import { ChartBackground, type BackgroundVariant } from "@/registry/ui/recharts-background";39import { TypedDataKey } from "recharts/types/util/typedDataKey";4041// Constants42const DEFAULT_INNER_RADIUS = "30%";43const DEFAULT_OUTER_RADIUS = "100%";44const DEFAULT_CORNER_RADIUS = 5;45const DEFAULT_BAR_SIZE = 14;46const LOADING_BARS = 5;47const LOADING_ANIMATION_DURATION = 1500; // in milliseconds — interval between skeleton data changes4849type RadialBarChartProps = ComponentProps<typeof RechartsRadialBarChart>;50type RadialBarRechartsProps = ComponentProps<typeof RechartsRadialBar>;5152type RadialVariant = "full" | "semi";5354// ─────────────────────────────────────────────────────────────────────────────55// Shared context56// ─────────────────────────────────────────────────────────────────────────────5758/**59 * Shared state for every part of the chart. Lifted into <EvilRadialChart /> so60 * that <RadialBar />, <Tooltip />, and <Legend /> can read it without prop61 * drilling. Sub-components are composed freely — the provider is the single62 * source of truth.63 */64type RadialChartContextValue = {65 config: ChartConfig; // colors + labels for every bar66 nameKey: string; // data key holding each bar's name67 chartId: string; // colon-free id scoping this chart's style defs68 isLoading: boolean; // whether the chart shows its loading skeleton69 selectedBar: string | null; // currently selected bar name, or null when none70// … 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 |
