Data & Visualization
Data viz, animated counters, charts and data-driven effects.
Updated
How do you animate charts and numbers without a charting library?
Small data visualizations such as counters, progress rings, bar and line charts can be drawn with HTML, CSS and SVG alone. Bars grow with a CSS transform, rings and lines animate SVG stroke-dashoffset, and counters are incremented in JavaScript when they enter the viewport, detected with IntersectionObserver.
How to choose, performance and accessibility
- Use Animated Counter or Stat Cards for key figures on a landing page, Progress Ring or Gauge Meter for completion, and Line Chart Draw or Sparkline for trends in a dashboard.
- Keep the final value in the HTML so it reads correctly without animation and for screen readers, label axes and units, and move to a charting library only when you need zooming, dense tooltips or live data.
- Animated Counter is free with its full code; the rest come with Premium.
Animated Counter
Counter that animates toward the target value.
View source code
<div class="demo-preview">
<div class="counter-container">
<span class="counter-value" data-target="8547">0</span>
<span class="counter-label">Active users</span>
</div>
</div>.demo-preview,
.demo-preview *,
.demo-preview *::before,
.demo-preview *::after {
box-sizing: border-box
}
.demo-preview {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 250px;
overflow: hidden;
position: relative;
background: rgb(26, 26, 36);
color: rgb(255, 255, 255);
font-family: sans-serif;
}
.counter-container {
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
}
.counter-value {
font-size: 3rem;
font-weight: 800;
background: linear-gradient(135deg, #6366f1, #d946ef);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.counter-label {
font-size: 0.875rem;
color: rgba(255, 255, 255, 0.6);
text-transform: uppercase;
letter-spacing: 2px;
}(function() {
function animateCounter(element, target, duration = 2000, isDecimal = false) {
const start = 0;
const startTime = performance.now();
function update(currentTime) {
const elapsed = currentTime - startTime;
const progress = Math.min(elapsed / duration, 1);
// Easing function (ease-out cubic)
const easeProgress = 1 - Math.pow(1 - progress, 3);
const current = start + (target - start) * easeProgress;
if (isDecimal) {
element.textContent = current.toFixed(1);
} else {
element.textContent = Math.floor(current).toLocaleString();
}
if (progress < 1) {
requestAnimationFrame(update);
} else {
if (isDecimal) {
element.textContent = target.toFixed(1);
} else {
element.textContent = target.toLocaleString();
}
}
}
requestAnimationFrame(update);
}
// Lance le compteur quand il entre à l'écran (moitié visible)
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const element = entry.target;
const target = parseFloat(element.dataset.target);
const isDecimal = element.dataset.target.includes('.');
animateCounter(element, target, 2000, isDecimal);
observer.unobserve(element);
}
});
}, {
threshold: 0.5
});
document.querySelectorAll('.counter-value[data-target]').forEach(el => observer.observe(el));
})();Progress Ring
Animated circular progress ring.
Bar Chart Animated
Bar chart with animated growth effect.
Line Chart Draw
Line that draws itself progressively.
Pie Chart Reveal
Pie chart with segments that appear sequentially.
Gauge Meter
Animated gauge with speedometer style.
Stat Cards
Stat cards with animated counters.
Comparison Bars
Horizontal bars to compare values.
Donut Chart
Donut chart with sequential animation.
Sparkline
Mini line chart for trend tracking.
Counter Animation CSS
Pure CSS animated counter using @property.
Circular Progress SVG
Progress circle with animation.
Animated Bar Chart
Bar chart with animated growth.
Donut Chart CSS
Donut chart using conic-gradient.
Gauge Meter CSS
Circular gauge in pure CSS.
Step Progress Indicator
Step indicator with animation.
Star Rating Animated
Interactive stars with animation.
Line Chart Drawing
SVG line chart with drawing animation.
Counter Odometer
Digits that scroll like an odometer, each digit in its own container with vertical scrolling.
Animated Donut Chart
Donut chart with animated segments using conic-gradient and CSS @property for smooth transitions.
Live Sparkline
Inline SVG sparkline with animated point addition and smooth path transitions.
Gauge Meter
Semi-circular gauge with smooth needle rotation via CSS transform: rotate().
Bar Chart Race
Horizontal bars that reorder with CSS transitions on width and order.
Morphing Pie Chart
Pie segments that morph between data states with conic-gradient transitions.
Animated Stat Counter
Counters that increment with easing, comma formatting, via requestAnimationFrame.
Progress Steps
Multi-step indicator with animated connection lines and state color transitions.
Data Table Row Animation
Table rows that slide in, highlight on hover, and reorder smoothly.
Heatmap Cell Animation
Grid cells changing color based on intensity with smooth CSS transitions.