Bring Your Data to Life: Animated Storytelling with CanvasXpress's Keyframe Timeline
If you've ever watched Hans Rosling's famous "200 Countries, 200 Years" Gapminder animation — bubbles sweeping across decades of health and wealth data — you've seen how powerful a well-built animated chart can be. A single static plot shows you a moment. An animated one shows you a story.
CanvasXpress makes that kind of storytelling a built-in capability, not a custom project. Using the workflowBy configuration option, you can turn any factor or metadata column in your dataset — a year, a stage, a cohort, a region — into a keyframe timeline that drives your chart through time, complete with play/stop controls, a draggable scrubber, and smooth, object-constant transitions between frames.
One Option, Many Chart Types
The feature is often associated with scatter plots — and it's a natural fit there, letting bubbles glide from one position to the next as your "animate by" variable advances. But workflowBy isn't limited to scatter plots. It works just as well with bar charts (watch rankings reorder as a grouping variable changes), maps (watch regional values evolve across time periods), and line/area charts, among others. If your data has a dimension you want to "play through," workflowBy can likely drive it.
Here's the basic idea in practice — animating a bar chart over a grouping variable:
var cx = new CanvasXpress("chartCanvas", data, {
graphType: "Bar",
workflowBy: "Year",
workflowLoop: true,
workflowFrameDuration: 600
});
With that config, CanvasXpress automatically builds a timeline UI beneath the chart: a play button, a scrubber track, and frame markers corresponding to each level of your Year column (or whatever factor you choose). Click play, and the chart steps through each level, smoothly tweening bars, points, or map regions from one state to the next.
Fine-Tuning the Playback Experience
Two playback refinements make workflowBy animations easier to tune for presentations, dashboards, or embedded reports.
Looping. By default, an animation plays once and stops at the final frame — useful for a guided walkthrough, but not ideal if you want a chart to run continuously on a kiosk display or an auto-refreshing dashboard tile. Setting workflowLoop: true tells the chart to restart automatically from the first frame once it reaches the end, so the animation keeps cycling without any manual re-triggering.
Frame speed. Previously, the pacing of an animation frame was tied to a general-purpose UI timing setting used elsewhere in CanvasXpress. Now you can control playback speed directly and explicitly with workflowFrameDuration, specified in milliseconds per frame. Want a fast-paced flourish for a presentation opener? Drop it to 200–300ms. Want a slow, deliberate reveal for a data story your audience needs time to absorb? Push it up to 1000ms or more. Leaving it unset preserves the existing default pacing, so nothing changes unless you opt in.
Both options live alongside the rest of the workflow/animation settings in the chart configuration, and both can be adjusted at runtime the same way you'd update any other configuration value:
cx.updateConfig({ workflowLoop: true, workflowFrameDuration: 400 }, true);
That second argument tells CanvasXpress to redraw immediately, so you can wire these settings up to a speed slider or a loop checkbox in your own UI and see the effect live.
Styling the Timeline
Because the scrubber, play/stop button, and timeline track are real chart widgets, they inherit the same theming approach as the rest of CanvasXpress — you can adjust slider colors, timeline track appearance, and button styling through the corresponding configuration properties to match your chart's or application's visual identity, rather than being stuck with a one-size-fits-all control bar.
Sharing and Reproducing Animated Charts
Once you've built an animated chart you're happy with, CanvasXpress's standard save/reload workflow applies here too. Use the Save as JSON option from the chart's toolbar to serialize the complete chart — data, configuration, and your workflowBy/workflowLoop/workflowFrameDuration settings included — into a portable file. Anyone can reload that exact animated chart later simply by dragging the saved .json file onto a CanvasXpress container; there's no need to re-author the animation setup. If you ever need to show how the chart was built, step by step, the toolbar's Reproduce action will replay its construction for you — a handy way to document or teach an animated-chart workflow without writing a tutorial by hand.
Why This Matters
Animated, variable-driven charts used to be something you reached for a bespoke JavaScript library or a dedicated animation framework to build. With workflowBy and its new playback controls, that capability is just a few configuration properties away, available across the chart types you're already using in CanvasXpress — bars, maps, scatter plots, and more. Whether you're building an executive dashboard that loops a regional sales map in the lobby, or a research figure that steps through experimental time points one careful frame at a time, the tools to do it are already in your hands.
Try dropping workflowBy into your next chart configuration, point it at a time or category column you already have, and watch your data tell its own story — frame by frame.