Radial Chart
Documentation Index
Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.
Beautiful radial bar charts with full and semi-circle variants, gradient colors, and glow effects
Installation
Usage
The radial chart is composible. <EvilRadialChart> is the container, and you compose only the parts you need — <Legend>, <Tooltip>, and a <RadialBar> — as its children. The <RadialBar> carries its own glowingBars and isClickable, so styling and interactivity live with the series itself.
import {
EvilRadialChart,
RadialBar,
Tooltip,
Legend,
} from "@/components/evilcharts/charts/radial-chart";const data = [
{ browser: "chrome", visitors: 275 },
{ browser: "safari", visitors: 200 },
{ browser: "firefox", visitors: 187 },
];
const chartConfig = {
chrome: {
label: "Chrome",
colors: { light: ["#3b82f6"], dark: ["#60a5fa"] },
},
safari: {
label: "Safari",
colors: { light: ["#10b981"], dark: ["#34d399"] },
},
firefox: {
label: "Firefox",
colors: { light: ["#f59e0b"], dark: ["#fbbf24"] },
},
} satisfies ChartConfig;<EvilRadialChart data={data} nameKey="browser" config={chartConfig} variant="full">
<Legend isClickable />
<Tooltip />
<RadialBar dataKey="visitors" isClickable glowingBars={["chrome"]} />
</EvilRadialChart>Interactive Selection
Add isClickable to <RadialBar> (and to <Legend>) to make bars selectable. Use the onSelectionChange callback on <EvilRadialChart> to handle selection events:
<EvilRadialChart
data={data}
nameKey="browser"
config={chartConfig}
onSelectionChange={(selection) => {
if (selection) {
console.log("Selected:", selection.dataKey, "Value:", selection.value);
} else {
console.log("Deselected");
}
}}
>
<Legend isClickable />
<Tooltip />
<RadialBar dataKey="visitors" isClickable />
</EvilRadialChart>Loading State
The radial chart supports loading state with a placeholder animation. You can pass the isLoading prop to the chart to show the loading state while your data is being fetched.
Examples
Below are some examples of the radial chart with different configurations. You can customize the variant, innerRadius, outerRadius, and other properties.
Semi-Circle Variant
Set variant="semi" to create a half-circle radial chart. This is useful for displaying progress or gauges in a more compact space.
Gradient Colors
Glowing Bars
Add a subtle glow effect to specific bars using the glowingBars prop on <RadialBar>. Pass an array of bar names (the values from your nameKey field) to specify which bars should glow.
API Reference
The chart is composed of several parts. The props below are grouped by the component they belong to.
The root container. It owns the data, the shared selection state, the loading skeleton, and the chart-wide arc shape. Everything visual is composed as its children.
The radial bar series. Each data row becomes one bar. It generates its own glow filter definitions, so glow effects never collide with other charts on the page.
The hover tooltip. Labels each bar by its name. Render it to show a tooltip, omit it for none.
The bar legend. When isClickable is set, each entry toggles selection of its bar. Render it to show a legend, omit it for none.