data-chart

Animation

Add data-chart-animate to any table for entrance animations. Each chart type has its own animation style.

Quick Start

<table data-chart="bar" data-chart-animate>
  ...
</table>

Live Examples

Click Replay to re-run any animation. Switch to Code to see the HTML source.

Bar Chart

Bars grow from the baseline with staggered delays

Quarterly Revenue
QuarterRevenueProfit
Q1420180
Q2580240
Q3510210
Q4690310

Line Chart

Line draws from left to right, then dots fade in

Monthly Users
MonthUsersActive
Jan1200900
Feb18001400
Mar15001100
Apr22001800
May28002200

Area Chart

Line draws across, then the area fill fades in

Weekly Visitors
WeekVisitors
W13200
W24100
W33800
W45200
W54800
W65900

Pie

Slices scale in one by one

OS Share
OSShare
Linux40
macOS32
Win28

Donut

Segments scale in with staggered delay

Task Status
StatusCount
Done45
Active30
Review15
Blocked10

Stacked Bar

Stacked segments grow from baseline together

Device Traffic
QDesktopMobileTablet
Q130020050
Q228025060
Q326030070
Q432035080

Horizontal Bar

Horizontal bars grow from left with stagger

Language Popularity
LanguageUsers
TypeScript850
Python720
Go510
Rust340

Animation by Chart Type

Element Animation Duration Stagger
.data-chart-bar Height grows from 0 600ms 60ms per bar
.data-chart-line Stroke draws left to right 960ms
.data-chart-dot Fade in after line completes 300ms 80ms per dot
.data-chart-area Opacity fades in 800ms 400ms delay
.data-chart-slice Scale from center 600ms 80ms per slice

Customization

Duration

Control animation speed per element:

<table data-chart="bar" data-chart-animate data-chart-animate-duration="1200">

Default: 600ms. Range: any positive number.

Stagger

Control delay between elements:

<table data-chart="bar" data-chart-animate data-chart-animate-stagger="100">

Default: 60ms. Higher values create more sequential animations.

Combined

<table
  data-chart="line"
  data-chart-animate
  data-chart-animate-duration="300"
  data-chart-animate-stagger="30"
>

Reduced Motion

Animations are automatically disabled when prefers-reduced-motion: reduce is set. No additional configuration needed. Charts render instantly in their final state.