Skip to content

feat(charts): generalize the Python chart example with brand themes - #165

Open
AsharibAli wants to merge 11 commits into
digitalsamba:mainfrom
AsharibAli:feat/standalone-data-video
Open

AsharibAli wants to merge 11 commits into
digitalsamba:mainfrom
AsharibAli:feat/standalone-data-video

Conversation

@AsharibAli

@AsharibAli AsharibAli commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

The existing Python chart example now accepts CSV/JSON specs through one shared renderer. Matplotlib draws the data, and Pillow overlays author-written text through MoviePy.

  • Space dated lines by actual calendar time, sort dates with their values and use month ticks such as Jan 2026. Missing months keep their true gap. Categorical labels retain equal spacing.
  • Show the bar chart's period above the plot. During interpolation the label names the transition, then holds the final period with its values.
  • Draw bars and the first line in the brand primary. Additional lines share one neutral, and a single line has no legend.
  • Restore the bundled example's author-written 718 stars headline. headlineStartSeconds: 10 and headlineFadeSeconds: 0.5 control its reveal. Validate timing against the final duration, including narration-driven duration.
  • Load colours and fonts with --brand. Resolve generic families such as system-ui without falsely reporting a missing font. Record actual font selection and fallback when a requested family is unavailable.
  • Keep title, attribution, headline and narration under the author's control. Reports record dataset and brand hashes. Reuse the shared media_ops.py now on main for validation, hashing and atomic report writes.
  • Run by default, replace completed outputs atomically and provide a write-free --dry-run. Update CLAUDE.md, the registry, example README and both MoviePy skill references.

Validation passed all 19 focused chart tests. The full Python suite ran 218 tests, with 201 passing and 17 skipped for POSIX-only checks or the uninstalled optional YouTube extra. Undefined-name lint and copy lint passed. The complete bundled example rendered at 1920x1080 for 15 seconds, and a multi-period bar chart rendered at 1280x720 for 3 seconds. Decoded frames verified the headline fade and were visually inspected for dates, colours and period text.

This uses the existing Matplotlib, Pillow, MoviePy and FFmpeg dependencies. No hosted service, model download or paid inference is added.

Feature inventory

Copilot AI balanced review requested due to automatic review settings November 2, 2026 20:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@ConalMullan ConalMullan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Turning examples/data-viz-chart (Matplotlib for the data, deterministic text on top) into something that works with any dataset is useful, and it builds on a pattern the toolkit already documents. To fit it in:

  • Generalise the example rather than adding a separate tool. Either give examples/data-viz-chart/build.py a --spec chart.json option, or have the example call this tool, so there's one implementation of the pattern, not two. If it stays a tool, the example should use it.
  • Drop the derived narration. Text generated from the values ("X rose to Y") reads as filler. The script should come from the author. Recording the dataset hash is fine.
  • Take brand colours and fonts with --brand <name> (from brands/<name>/brand.json) instead of Matplotlib defaults.
  • Keep titles, source and headline numbers as overlay text, as the example does, rather than as Matplotlib text.
  • tools/media_ops.py comes in once via #162. Run by default (no --run), overwrite outputs, temp file + os.replace, and document it in CLAUDE.md and the registry entry instead of docs/data-video.md.

Separately, a Remotion-native <DataChart> component (brand-themed, revealed on narration cues) is going on our roadmap. That's a different piece of work and doesn't block this one.

@AsharibAli AsharibAli changed the title feat(data-video): render reusable charts from CSV or JSON feat(charts): generalize the Python chart example with brand themes Nov 7, 2026
@AsharibAli

Copy link
Copy Markdown
Contributor Author

@ConalMullan, I addressed your review in 7589435, e078e4b and 0396d80. I also resolved the registry conflict against current main.

  • The example now calls the shared renderer, and accepts --spec chart.json. The bundled dataset and custom data use the same implementation.
  • Derived narration and script output are removed. Narration, titles, attribution and headline numbers come from the author; dataset and brand hashes remain in the report.
  • --brand <name> loads the brand's colours and primary font list. The report names the installed font used and records a fallback when necessary.
  • Titles, source attribution and headline text are deterministic Pillow overlays composited through MoviePy. Matplotlib draws the data and axes.
  • Execution is the default. Completed outputs overwrite atomically on the same filesystem with os.replace. The duplicate shared module and per-tool document are removed. Documentation is in CLAUDE.md, the registry and the existing example README.

All seven focused tests passed. I also rendered and visually inspected the full 15-second, 1920x1080 bundled example. The existing Remotion DataChart implementation on main is unchanged. The five updated branches merge together without conflicts. Combined verification ran 153 Python tests, with 151 passing and two POSIX process tests skipped on Windows. The existing undefined-name lint passed. A real combined CLI flow produced a 1080x1920 Short with joined audio, ducked music, timed effects, SRT/VTT and a QC-normalized mix measured at -14.03 LUFS.

@ConalMullan ConalMullan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this round. The single renderer, brand loading and author-only narration are just what we hoped for, and the tests pass here. I rendered the bundled line example and a small bar chart to check the frames, and a few things showed up before we merge:

  1. Line charts are spaced by row, not by date. The star series is sampled every one or two days, so the gaps between ticks vary, and monthly data with a missing month would draw a misleading slope. Please space the x axis by real dates when the period parses as one, with readable month ticks ("Jan 2026") as the old example had.
  2. Bar charts animate from one period to the next but never show which period is on screen. Please show the current period, or render one period only.
  3. Each bar takes a different brand colour. Our design rules allow one data accent: please draw bars and single lines in the brand primary, with any other data in one neutral. A single series also doesn't need a legend.
  4. Could the example get its headline number back (718 stars), with the text fading in at a time set in the spec, as the old build did? With the headline empty there is a wide gap above the chart.
  5. Small: the moviepy skill (.claude/skills/moviepy/SKILL.md, lines 25 and 250) still describes the old example, and fontFallback is always true for the default brand because its first font is system-ui.

Happy to help if any of this is unclear. The other four PRs are in now (#162 and #163 merged, #161 and #167 merging with small fixes from us), so thanks for sticking with these.

@AsharibAli

Copy link
Copy Markdown
Contributor Author

@ConalMullan, I addressed this review in ef53d32 and fd809de.

  1. Dated lines now use real calendar coordinates and month labels. Dates sort with their values, and missing days or months retain their true gap. Categorical periods keep equal spacing.
  2. Bars display the current period. Interpolated frames explicitly name the transition, such as Jan → Feb, before holding the final period and its values.
  3. Bars and single lines use the brand primary. Additional lines share one neutral, and single-line legends are removed.
  4. The bundled spec restores 718 stars, fading in at 10 seconds over 0.5 seconds. headlineStartSeconds and headlineFadeSeconds control this, with timing validation against the final video duration.
  5. Both MoviePy skill references are updated, along with the example README, registry and CLAUDE guidance. fontFallback now tracks whether an earlier requested family was unavailable. Resolving system-ui or another first-choice generic family no longer reports a missing font.

The branch also uses the shared media helpers now available through #162.

All 19 focused chart tests passed. The full suite ran 218 tests, with 201 passing and 17 existing platform or optional YouTube dependency skips. I rendered and inspected the full 15-second, 1920x1080 example and a 3-second, 1280x720 multi-period bar chart. Decoded MP4 frames also confirmed the headline was hidden before its start, partially visible during the fade and fully visible afterward. Undefined-name lint and copy lint passed. GitHub's unit-test job is still installing FFmpeg.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants