--- name: data-story-charts description: Data-story videos where an animated chart carries the argument - lines that draw as time passes, bars that grow, a big counter that ticks, axes that rescale when the data surprises, annotation pins on the key moments - rendered to MP4 at 9:16 or 16:9 with HyperFrames, SVG and GSAP. Use whenever someone wants to animate statistics, show a trend, growth or cost over time, compare numbers, break down a figure (salary, budget, benchmark), or turn a dataset or table into a short narrated video. Not for architecture or request flows (use system-diagram-animation) or text-only videos (use kinetic-typography). license: MIT compatibility: HyperFrames (Node 22+, FFmpeg) with GSAP and inline SVG. Fonts from Google Fonts. --- # Data Story Charts One chart, built and revealed in the order of the story. The number is the hero: a big counter at the top, a line or bars that move with it, and annotation pins that say why it changed. It should feel like explanatory journalism: clear, calm, with one or two dramatic moments. ## Options | Option | Default | Notes | |---|---|---| | format | vertical 1080×1920 | or landscape 1920×1080 | | duration | 15–20 s | about 3–5 s per data beat | | chart | line | `line` (change over time), `bars` (compare), `stacked` (break down a total), `counter` (one big number) | | tone | editorial | `editorial` (default, light paper), `dark` (navy, glowing accent), `punchy` (faster, colour flips on the big moment) | ## Brief (answer before planning) 1. What is the one number or change the viewer should remember? 2. What is the data (paste or file)? Units, time range, source. 3. What is the surprise: a spike, a drop, a crossing, a hidden cost? 4. Which 2–4 moments deserve an annotation pin? 5. What is the closing line? Use only real numbers the user gave, or numbers you computed from their data. Never invent data. If something is an estimate, say so on screen. ## Reads sheet (write it with the beat list) For every beat, write the one thing the viewer must understand ("the robot can't fly", "the cache missed") and how long it stays readable. One read at a time. Text floors: a label stays at least 0.8 s, a sentence about 0.3 s per word once fully on screen. If the text won't fit the time, cut words rather than speed up. ## Motion discipline - Motion is causal: every move has a reason on screen (a click, a fall, a packet arriving), and the next move follows from it. - Pick one main direction of travel for the whole video and keep it. Use the other directions for meaning: up for success or conclusion, a zoom out for "here's the whole picture". - A scene's exit sets up the next entry: same axis, same direction, similar speed. Carry one object across the change instead of crossfading. - No idle filler motion (floating, breathing, wobbling) on diagrams, charts or text. If nothing should move, hold still; one deliberate camera drift is enough. - Easing: smooth ease-out for entries (`power2.out` to `power4.out`), quicker ease-in for exits (about 75% of the entry time). Entries at most 0.8 s. Total stagger for a group at most 0.5 s. Overshoot (`back.out`) only for small pops; no elastic or bounce. - One thing moves at a time when it matters; the eye can follow only one. - Add a 0.3–0.75 s beat of stillness right before the payoff. ## Style rules (always) 1. One chart type per scene and one series in focus. Other series are grey. 2. The chart is revealed by time or by story: lines draw left to right, bars grow in order, and nothing appears before it is talked about. 3. A big counter shows the current value and ticks with the chart (tabular numbers). 4. When the data outgrows the axis, the axis rescales on screen (an eased tween of the scale and its labels). That rescale is usually the best moment in the video. 5. Pins annotate the 2–4 key points with short labels. 6. Every label passes 3:1 contrast. Grid and tick labels are a muted dark grey, not pale grey. ## Defaults and overrides Precedence: the user's brand or spec, then the explicit request, then these defaults. - Editorial: paper `#f7f4ee`, ink `#16213a`, grid `#e3ded4`, tick labels `#5b6270`, accent `#e4572e`, positive `#047857`, warning `#a16207`, negative `#c2410c`. - Dark: stage `#0f1724`, ink `#f2f5f9`, grid `#1f2b3d`, labels `#9fb0c8`, accent `#38d6e0`. - Font: Inter (900 for the counter at 140–170 px, 800 for captions at 56–64 px, 600 for labels at 26–30 px). ## Setup (once) ```bash node -v && ffmpeg -version npx hyperframes init my-video --non-interactive --resolution portrait && cd my-video # landscape for 16:9 ``` ## Route | Need | SVG + GSAP in HyperFrames (default) | Remotion | D3 inside HyperFrames | |---|:-:|:-:|:-:| | Lines, bars, counters, pins | yes | yes | yes | | Thousands of points or map projections | heavy | heavy | yes (draw from time `t`) | | Runs with only Node and FFmpeg | yes | yes | yes | ## Layout - **9:16:** kicker label at y 285, counter at y 350 (150 px), chart area x 120–960 by y 520–1000, axis labels below, caption at y 1110–1250. - **16:9:** counter top-left, chart x 200–1720 by y 260–880, caption bottom-left or right of the chart. - Pins sit above their data point with a dashed stem. Keep them clear of the counter and the caption. ## How to animate it (seek-safe) Write the data as a function or an array, and draw the whole chart from one clock value `t`. One tween drives the clock, and its `onUpdate` redraws: ```js const clock = { t: 0 }; tl.to(clock, { t: DURATION, duration: DURATION, ease: "none", onUpdate: () => draw(clock.t) }, 0); draw(0); ``` `draw(t)` rebuilds the line path up to `t`, moves the marker and the counter, and positions pins and axis labels from the current axis maximum (itself a function of `t`). Because every pixel comes from `t`, any frame renders the same whenever HyperFrames seeks to it. | Move | How | |---|---| | Line reveal | path built from samples up to `t` (about 30 per second of data) | | Area under the line | the same path closed to the baseline, accent colour at 12% opacity | | Bars grow | heights tween from 0 with a 0.08 s stagger, `power3.out` | | Counter | text from the current value; 1 decimal under 10, whole numbers above | | Axis rescale | `yMax(t)` eases from the old to the new maximum over 1–1.5 s, while tick labels update | | Pin pop | scale 0.5 → 1 with `back.out(2.5)` at its time | | Emphasis | the counter scales 1.12 yoyo on the key number | ## Make it eye-catching - The first frame already has the counter, the axes and the question. - The surprise moment gets the rescale, a pin and a caption change all within half a second. - A small marker (a dot, an icon or a character) rides the tip of the line, so the eye knows where to look. - The area fill and a soft accent glow on the leading point give depth without clutter. - Captions are short sentences with the number in the accent colour ("Then: **120 m.**"). - Every frozen frame states a fact on its own. ## Starter ```html