Skip to main content
Version: 1.0.3

AnimatedBarChart

The AnimatedBarChart renders animated SVG vertical bar charts. Individual bars animate in with staggered delays from the baseline, dim when another bar is hovered, and support grouped multi-series layouts. It includes y-axis auto-tick computation, value labels, and configurable grid/label display.

Monthly Revenue

Jan – Jun 2024

7.9k5.9k4.0k2.0k0JanFebMarAprMayJun

Installation​

ignix add component animated-bar-chart

Usage​

import { AnimatedBarChart } from './components/ui/animated-bar-chart';

const data = [
{ label: "Jan", value: 3200, color: "#6366f1" },
{ label: "Feb", value: 4100, color: "#8b5cf6" },
{ label: "Mar", value: 5800, color: "#ec4899" },
{ label: "Apr", value: 4700, color: "#10b981" },
{ label: "May", value: 6900, color: "#f59e0b" },
];

export default function Dashboard() {
return (
<AnimatedBarChart
data={data}
title="Monthly Revenue"
subtitle="Jan – May 2024"
showValues
/>
);
}

Grouped Multi-Series Chart​

const series = [
{
name: "Online",
color: "#6366f1",
data: [
{ label: "Q1", value: 12000 },
{ label: "Q2", value: 18000 },
],
},
{
name: "In-Store",
color: "#10b981",
data: [
{ label: "Q1", value: 9000 },
{ label: "Q2", value: 11000 },
],
},
];

<AnimatedBarChart
data={[]}
series={series}
title="Quarterly Sales"
subtitle="Online vs In-Store"
showLegend
/>

Props​

ParameterTypeDefaultDescription
dataBarDataPoint[]requiredArray of single-bar data with label, value, and optional per-bar color.
seriesBarSeries[]-Optional grouped series data for multi-bar charts.
titlestring-Optional chart title.
subtitlestring-Optional subtitle below the title.
heightnumber280SVG chart height in pixels.
showXLabelsbooleantrueShow bar category labels on the x-axis.
showYLabelsbooleantrueShow value labels on the y-axis.
showGridbooleantrueShow horizontal dashed grid lines.
showLegendbooleantrueShow series legend (grouped series only).
showValuesbooleanfalseDisplay value annotations above each bar.
barRadiusnumber4Border radius applied to bar tops.
defaultColorstring"#6366f1"Fallback color for bars without a color property.
variant'default' | 'dark' | 'glass' | 'minimal''default'Theme variant.
classNamestring-Additional CSS classes for the container.