- D 95.5%
- Python 2.3%
- JavaScript 0.8%
- CSS 0.7%
- HTML 0.7%
|
|
||
|---|---|---|
| assets | ||
| scenes | ||
| server | ||
| source | ||
| tools | ||
| web | ||
| .gitignore | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| dub.json | ||
| dub.selections.json | ||
| dub.settings.json | ||
| README.md | ||
| SCENES.md | ||
daviz
Animated data visualizations in a chunky pixel look, made for YouTube videos: bar charts that grow from the bottom, pies that sweep in, tables, line charts and math formulas, with thick outlines and vibrant colors. Built with Parin and parin_kit.
A video's charts are a scene: a text file in scenes/ with the data (CSV) and the beats ("show the title, grow
the bars, highlight the biggest one"). daviz plays it in a window, reloads it when you save the file, and exports it
frame by frame to video.
It has titles and text, counters, KPI tiles and callouts, bar charts (upright, sideways, stacked, grouped, races, pictograms), line charts, pies and donuts, tables, math formulas in TeX, function plots, scatter plots, histograms, box plots and violins. For stories over time: bubbles that play through the years, bump charts, timelines and Gantt charts. For parts of a whole: waffles and unit charts, treemaps, sunbursts, sankeys, waterfalls and funnels. For comparisons: dumbbell and slope charts, population pyramids, versus cards, radars, gauges, progress rings, heatmaps and calendars. And world maps, trees, node graphs, Venn diagrams, chord diagrams and flowcharts, annotations on charts, a camera that zooms to any part of the scene, animated backgrounds, and a voiceover that plays along. See SCENES.md for the scene format and the keys of the player, and the issues for what's next.
Your first scene
-
Put your data in a CSV file in
scenes/, likescenes/coffee.csv:country,cups Finland,12 Norway,9.9 Iceland,9 Denmark,8.7 Germany,5.2 -
Write a scene next to it,
scenes/coffee.txt:data coffee = coffee.csv title t "Coffee per person" bars chart data=coffee x=country y=cups suffix=" kg" caption source "Source: made up" align=left 0 show t +0.5 show chart +0.3 show source +3 highlight chart Finland -
Play it with
dub run -- coffee. Keep the window open while you edit the scene or the CSV: it reloads with every save. Space plays and pauses, Left/Right step through the frames. -
Export it with
dub run -- coffee --export exports/coffee.mp4and put the MP4 into your video editor.
SCENES.md lists every element, option and beat.
Templates
The formats data videos use again and again, made from a CSV in one step as an ordinary scene to edit from there:
dub run -- new ranking scenes/coffee.csv # a countdown from the last place to the first
dub run -- new compare scenes/games.csv # then vs now: bars that change to the second column
dub run -- new race scenes/languages.csv # a bar chart race through the number columns
dub run -- new map scenes/coffee.csv # a map that zooms to the three biggest
dub run -- new endscreen # the end of a video, for YouTube's end screen elements
The editor's New button has them too, made from the first CSV file of the open scene.
Slides
Scenes can also be slides: a deck (scenes/quarterly.deck) lists scenes in order, and dub run -- present quarterly presents them fullscreen. Each slide plays to its next stop (+1 stop in the scene) and waits for a click
or a presenter clicker, with transitions between the slides, an overview of all slides on G, and E to export the
whole deck as one video. The editor edits decks too: the slides as pictures above the canvas, to open, reorder and
add, and the stops on the timeline. See SCENES.md.
On the web
tools/build_web_player.sh --release builds the player for the browser into web/, and server/ is a website for
it: upload a show with dub run -- upload quarterly (or a bundle from dub run -- pack quarterly), share the link,
and present it live while everyone who opens the link follows your slides. See server/README.md.
The editor
dub run -- edit coffee (or Tab in the player) opens the scene in the visual editor: drag charts from the palette
onto the canvas, move and resize them, set their options in the inspector and their beats on the timeline. It
writes every change into the scene file in place, so the file stays readable and hand-written lines and comments
stay. See SCENES.md.
Example scenes
| Scene | Shows |
|---|---|
tour |
Every feature in one 3.5 minute scene: all 48 kinds of elements, an animated background, highlights, changes, the camera and a voiceover (data in scenes/tour/). |
quarterly.deck |
A deck of four slides (scenes/quarterly/): stops, a highlight on a click, transitions. dub run -- present quarterly. |
youtube.deck |
The video features, a slide each (scenes/youtube/): entrances and exits, emphasis beats, camera moves, images, arrows, lower thirds, subscribe, a brand logo, beats on the words of a transcript, ducked music and sound effects, an end screen. dub run -- present youtube. |
youtube_short.txt |
The same as a vertical Short (canvas = vertical) with chapters and a thumbnail beat. |
showcase |
A whole video segment: a title, a ranking with a callout, a pie, a formula, a counter and a line chart. |
demo |
Bars that grow, a highlight and a change to other data. |
ranking |
Horizontal bars with ranks and icons, reordering when the data changes. |
race |
A bar chart race, stacked bars, profit and loss below zero with targets, and pictogram bars of icons. |
pies |
A pie and a donut, a highlight and a change, then pies of groups that drill down into a slice. |
tables |
A table with row, column and cell highlights and scrolling, and one with bars, trend arrows and sparklines in its cells whose rows sort. |
lines |
Two lines with areas that draw themselves, a dashed forecast, names at their ends and a readout that glides. |
notes |
Counters and callouts, and KPI tiles with a line of their history. |
formulas |
Math formulas, a highlight and a morph. |
parts |
Parts of a whole: a waffle, a unit chart of icons, a treemap that zooms into a group, a sunburst, a sankey, a waterfall and a funnel. |
science |
A function plot, a scatter plot with a regression line, a histogram and a log axis; a scatter of groups with quadrants and a highlighted cluster; box plots and violins. |
time |
Stories over time: bubbles that play through the years, a bump chart of ranks and a timeline that zooms. |
compare |
Comparisons: a dumbbell and a slope chart, a radar, a gauge and progress rings, a heatmap and a calendar, a versus card and a population pyramid. |
maps |
A choropleth of Europe that zooms out to the world, bubbles with icons on a world map, and shipping routes between countries. |
diagrams |
A family tree, a node graph, venn diagrams of two to four sets, a flowchart that builds up step by step and a chord diagram of trade. |
style |
Every element in every series color, to check the look. |
annotations |
Reference lines and shaded ranges on a line chart and bars, following a change. |
camera |
The camera zooming to a bar, to a pie and back. |
backdrops |
Animated backgrounds: a gradient sky with stars and an animated skyline of your own, then every pattern. |
audio |
A scene with a voiceover and its waveform in the progress bar. |
The canvas
daviz draws on a 960x540 canvas, which scales by whole numbers to the video sizes: x2 is 1080p, x4 is 4K. The window starts at 1080p and scales the canvas up without smoothing, so the pixels stay sharp.
The theme
assets/theme.txt sets the look of the charts: the art pixel size, outline thickness and color, drop shadow, the
background and text colors, the series palette with a light and a dark shade per color for the toon look, the text
size of each role (title, label, number, caption) and the animation timing. Every key is optional and documented in
the file. daviz reloads it when you save it.
Sprites
Bars are sprites you can draw: assets/sprites/bar.png (and hbar.png, the same bar sideways) in grayscale, with
its parts in bar.txt: the cap on top, the body that stretches with the value and the base plate the bar
stands on. Black becomes the outline color, dark gray (#555555) the dark shade of the series color, light gray
(#aaaaaa) its base color and white its light shade. Each part is a 9-slice, so the outline and shading columns keep
their width when a bar gets wider. assets/sprites/plate.png is the plate behind callouts and table headers, a 9-slice
tinted the same way with their color. python3 tools/make_sprites.py draws the placeholders.
dub run -- style plays the style sheet: every element in every series color. Keep it open while you draw new
sprites or change the theme: it reloads with every save.
The font
The text uses a pixel font made from Monocraft by Idrees Hassan (SIL Open
Font License 1.1, see assets/fonts/OFL.txt), with the Greek letters and math symbols Monocraft lacks drawn in its
style. assets/fonts/text.png holds the glyphs, white on transparent, in cells of 8x12 pixels with the baseline under
row 9. assets/fonts/text.txt says which character is in which cell. Draw over the PNG in any pixel art editor:
daviz finds the width of each glyph from its opaque columns and reloads the font when you save (debug builds).
python3 tools/make_font.py (needs Pillow) makes the sheet again from Monocraft and the glyphs drawn as text art in
the script. It overwrites the PNG, so only run it to start over or to add characters.
The world map
Maps use the countries of Natural Earth (1:110m admin 0 countries, public
domain), simplified and rounded to 0.1 degrees into assets/maps/world.txt: a line per country with its ISO code,
continent and names, then its outlines in longitude and latitude. python3 -I tools/make_world_map.py <folder> assets/maps/world.txt makes it again from the unpacked
shapefile; the names people often
use (USA, UK, South Korea, ...) are added there.
Export
daviz exports frame by frame, with no screen recorder: every frame is drawn at its exact scene time, scaled up
without smoothing and written through ffmpeg (it has to be on the PATH) or as PNG files.
dub run -- demo --export exports/demo.mp4 # 1080p60 MP4 (H.264) of the whole scene.
dub run -- demo --export exports/demo.mp4 --scale 4 # 4K.
dub run -- demo --export exports/demo.mp4 --from 2 --to 6 # Only seconds 2 to 6.
dub run -- demo --bg green --export exports/demo_green.mp4 # Green screen, for keying in the editor.
dub run -- demo --bg transparent --export exports/demo/ # PNG files with alpha: exports/demo/frame_00001.png, ...
dub run -- demo --export exports/demo_%04d.png # PNG files named like that.
dub run -- demo --export exports/demo.mp4 --size 1440p --fps 30 # Any size: 720p, 1080p, 1440p, 4k or 2560x1440.
dub run -- demo --bg transparent --export exports/demo.mov # ProRes 4444 with alpha (.webm: VP9 with alpha).
dub run -- quarterly --clips exports/quarterly/ # A clip per slide (or per chapter of a scene).
dub run -- demo --preview # exports/demo-preview.mp4: 540p, 30 fps, fast.
dub run -- demo --thumbnail exports/demo.png --time 4 # A 1280x720 thumbnail of that moment.
Sizes that aren't whole multiples of the canvas (720p, 1440p) are drawn at the next whole multiple above and scaled
down with lanczos. A video export also writes <video>.chapters.txt with YouTube chapters (0:00 Title): one per
slide of a deck, or per chapter beat of a scene. The editor's Export button has all of these in a menu.
--fps sets the frame rate (default 60). In the player, E exports the whole scene to exports/<scene>.mp4, and Esc
cancels an export. At x2 every canvas pixel is a 2x2 block on even coordinates, which lines up with the color blocks
of H.264, so the colors of the pixel edges stay sharp in the MP4.
Build and run
dub run # Plays the first scene in scenes/.
dub run -- demo # Plays scenes/demo.txt.
dub run -- path/to/scene.txt # Plays that file.
dub run -- demo --shot out.png # Saves the canvas after a few frames and quits.
dub run -- demo --bg green # Overrides the background: solid, green or transparent.
dub run -- demo --time 2.5 # Starts paused at 2.5 seconds (with --shot: a picture of that moment).
dub run -- edit demo # Opens scenes/demo.txt in the editor.
dub build -b release # Release build.
Build with openD's LDC (ldc2 from openD), never with DMD or upstream LDC: openD is the
only compiler that builds Parin and parin_kit correctly. Put openD's bin folder first on the PATH.
dub.settings.json makes ldc2 dub's default compiler, so plain dub run uses it. On Linux nothing else is
needed. On Windows and macOS, run dub run parin:setup once first.
parin_kit is a git dependency in dub.json, pinned to a commit. To change parin_kit and daviz together, clone it next
to daviz and use "parin_kit": {"path": "../parin_kit"} instead.
Controls
Space plays and pauses, Left/Right step a frame (Shift: a second), Page Up/Down jump between beats. With the mouse,
drag the progress bar to seek (it snaps to beats), click to play or pause, and use the wheel to step frames.
Ctrl+click an element to open the scene file at its line, Alt+drag a beat mark to move the beat in the file, and M
to print the current time as a beat line (handy with audio = voice.ogg). All keys and mouse controls are in
SCENES.md. F1 opens the debug console and F2 the skin editor of the UI (debug builds).
Files
| File | What it does |
|---|---|
source/app.d |
Starts the player and runs the frame: the canvas size, the debug console, the skin editor, F11 for fullscreen, --shot. |
source/player_scene.d |
The player: finds the scene, plays it with the playback keys and the mouse, reloads it, shows its problems. |
source/scene_editing.d |
Editing the scene file from the player: moving beats, opening the file at a line in an editor. |
source/visual_editor.d |
The editor: the canvas between a palette, an inspector and a timeline; dropping, moving and resizing elements, their options and beats. On parin_kit's ui/drag_drop, ui/rect_gizmo, ui/text_edit and ui/timeline_tracks. |
source/scene_document.d |
Editing the scene file in place for the editor: options, new elements and tables, beats, renaming, deleting, undo. |
source/element_catalog.d |
The elements of the editor's palette, with their options and example data. |
source/option_docs.d |
The options of every element type, read from SCENES.md for the inspector. |
source/editor_input.d |
The mouse of the editor, or a script of mouse moves and keys to test it headless. |
source/backdrop.d |
Animated backgrounds behind the charts: their options, changes and eased scroll, drawn with parin_kit's fx/backdrops patterns and core/camera parallax layers. |
source/camera_element.d |
The camera: zooming and panning to elements, parts and boxes as beats. |
source/annotations.d |
Reference lines and shaded ranges on the axes of charts. |
source/scene.d |
Scene files: settings, data, elements and beats, and the base class of elements. |
source/segment_templates.d |
The templates of dub run -- new: ranking, compare, race, map tour, end screen. |
source/media_elements.d |
Images, arrows that draw themselves, lower thirds and the subscribe button. |
source/element_motion.d |
Entrance and exit styles and the emphasis beats of every element. |
source/soundtrack.d |
Music with ducking and sound beats in the player, and the audio mix of exports. |
source/transcript.d |
Transcripts of the voiceover (Whisper JSON, SRT, VTT) and beats timed by words. |
source/deck.d |
Deck files: scenes listed as slides, with their stops, transitions and the theme of the deck. |
source/deck_document.d |
Editing a deck file in place for the editor: moving, adding and removing slides, their options. |
source/presenter.d |
Presenting a deck: stops, clicks and clickers, transitions (parin_kit's scene/transitions), the overview and the video of a deck. |
source/bundle_format.d, source/bundle.d |
Bundles: a show with its files in one .daviz file; pack and upload. |
source/web_bridge.d |
How the web player talks to its page: where the presentation is, and commands like following a presenter. |
web/ |
The web player's page (shell.html, show_loader.js) and build options; tools/build_web_player.sh builds it there. |
server/ |
The website: uploads, the player, live presenting (arsd.cgi, HTMX, SQLite). |
source/slide_thumbnails.d |
The slides as pictures for the overview and the editor's slide list. |
source/data.d |
CSV tables, reading numbers with units and separators, writing numbers in labels. |
source/anim.d |
Easing and timing: entries with overshoot and stagger, exits. |
source/text_elements.d |
Titles, text and captions with letters that drop in. |
source/line_chart.d |
Line charts: lines that draw themselves, popping points, areas, end values, a legend. |
source/sci_plots.d |
Function plots, scatter plots with regression, groups and quadrants, histograms with a normal curve, log axes. |
source/box_plot.d |
Box plots and violins: quartiles, whiskers and outliers, densities, growing out from the median. |
source/bubble_chart.d |
Bubbles over time (Gapminder style): playing through the times, the big time label, trails, a legend. |
source/bump_chart.d |
Bump charts: ranks over time as crossing S-curves that draw themselves, dots with the ranks or values. |
source/timeline_chart.d |
Timelines and Gantt charts: a ruler that draws itself, bars in lanes, stacked pins, pans and zooms. |
source/pie_chart.d |
Pies and donuts: sweeping slices, rims, labels with leader lines or a legend, highlights. |
source/waffle_chart.d |
Waffle and unit charts: cells that fill one after the other, icons, a legend. |
source/treemap_chart.d |
Treemaps and sunbursts: tiles in group panels, zooming into a group, rings that sweep in. |
source/sankey_chart.d |
Sankey diagrams on parin_kit's algorithm/sankey layout: S-curved bands that draw themselves, highlights of a node. |
source/waterfall_chart.d |
Waterfalls: floating steps from the running total, totals on plates, connector lines. |
source/funnel_chart.d |
Funnels: bands that unfold from the top and narrow with the values, the drop to the next step in percent. |
source/table_chart.d |
Tables: unfolding rows, counting numbers, highlights of rows, columns and cells, scrolling. |
source/tracks.d |
The values of a chart over its changes, and reading labels and values from a table. |
source/export.d |
Frame-exact export: steps the scene time, writes through parin_kit's core/recorder. |
source/formula.d |
TeX formulas: a parser and a box layout in font pixels. |
source/formula_element.d |
Formulas in scenes: writing on, highlights by TeX, morphing into a new formula. |
source/note_elements.d |
Counters that count to a number, and callouts with arrows to parts of other elements. |
source/kpi_tile.d |
KPI tiles: the last value counting up, its change with an arrow, and a sparkline of the history. |
source/bar_chart.d |
Bar charts and horizontal bars: bars that grow from their plates, counting values, gridlines, ranks, icons, highlights, changes. |
source/bar_chart.d |
Bar charts and horizontal bars: bars that grow from their plates, counting values, gridlines, ranks, icons, bars below zero, targets, highlights, changes. |
source/pictogram_chart.d |
Pictogram bars: rows or columns of icons, one per a set amount, the last one cut, popping in one after the other. |
source/dumbbell_chart.d |
Dumbbell and slope charts: two values per category, dots joined by growing bars, lines between two axes. |
source/pyramid_chart.d |
Population pyramids: two bar charts back to back from a shared middle with the labels in it. |
source/versus_card.d |
Versus cards: two names facing each other with a big VS, bars per stat to both sides, the winner lit. |
source/radar_chart.d |
Radar charts: a web of rings and spokes, and a shape per series that grows out from the center. |
source/gauge_chart.d |
Gauges with zones and a swinging needle, and progress rings that fill clockwise, nested like activity rings. |
source/heatmap_chart.d |
Heatmaps with cells that pop in diagonally, and calendar heatmaps that fill day by day. |
source/map_chart.d |
World maps: countries filled by value or with bubbles, outlines between them, zooming to a focus, icons and routes. |
source/tree_chart.d |
Trees that grow level by level, and node graphs with the force-directed layout of parin_kit's algorithm/graph_layout. |
source/venn_chart.d |
Venn diagrams of two to four sets: circles (or four ellipses) that slide together, counts and labels in each part. |
source/chord_chart.d |
Chord diagrams: arcs that sweep in around a circle and ribbons between them that draw themselves. |
source/flow_chart.d |
Flowcharts: steps in layers (algorithm/graph_layout) with arrows, revealed step by step. |
source/diagrams.d |
What maps and diagrams share: highlight fades, toon shapes, lines that draw themselves. |
source/canvas.d |
The canvas: its size, the background modes and the grid of art pixels. |
source/art_grid.d |
The art pixel grid and look for parin_kit's pixel shapes (fx/pixel_shapes). |
source/icons.d |
Icons from assets/icons/, tinted with the series colors, with a drop shadow. |
source/sprites.d |
Sprites tinted with the series colors that stretch with the data, like the bars. |
source/look.d |
The look of the charts, read from assets/theme.txt. |
source/text_lines.d |
Reads daviz's text files with parin_kit's spaced comments, which leave hex colors alone. |
source/theme.d |
The look of the UI overlay: the skin parts and colors. |
source/assets.d |
Loads the skin, the font (parin_kit's ui/bitmap_font), the sprites and icons, and reloads them. |
source/options.d |
Fullscreen and vsync, saved in saves/settings.txt. |
scenes/ |
The scene files. |
assets/ |
The theme (theme.txt), the font (fonts/), the sprites (sprites/), icons for rankings, unit charts and maps (icons/), the world map (maps/) and the skin of the UI (skin.png, skin.txt). |
tools/make_font.py |
Makes the pixel font from Monocraft (needs Pillow). |
tools/make_world_map.py |
Makes assets/maps/world.txt from Natural Earth's countries (plain Python). |
tools/make_sprites.py |
Draws the placeholder bar sprites (needs Pillow). |
tools/make_skin.py |
Draws the placeholder skin (needs Pillow). |
daviz started from parin_game_template; the menus, audio, splash, web and Android builds of the template are removed.