Lessons from building a reusable D3.js visualization framework
2026-07-03
When I joined IQVIA in 2018, clinical trial dashboards across teams were built on licensed third-party visualization tools. Every team paid for seats, every chart looked slightly different, and customization requests went through a vendor. Over the next two years we replaced that with an in-house, reusable D3.js framework, eventually adopted by more than 10 teams and eliminating over $500K in licensing costs.
Here are the lessons that stuck with me.
1. A framework is an API design problem, not a charting problem
The hard part of D3 isn't drawing axes. It's deciding what your consumers should not have to think about. Our first version exposed too much: teams could configure scales, transitions, and margins individually, and every dashboard drifted apart visually. The second version inverted this: sensible defaults for everything, with escape hatches only where teams had demonstrated a real need.
The rule we landed on: every configuration option is a maintenance contract. Add them reluctantly.
2. Composition beats configuration
Instead of one mega-chart component with 40 options, we shipped small composable pieces (scales, axes, legends, tooltips, interaction layers) plus a handful of pre-assembled charts covering the 80% case. Teams with unusual needs composed their own from the same primitives, so even "custom" charts stayed consistent.
3. Adoption is a product problem
Teams don't adopt internal frameworks because they exist; they adopt them because the first hour is easy. What moved the needle for us:
- A live gallery where every chart's source could be copied
- Migration guides written per-team, not generic docs
- A tech talk circuit inside the company (my January 2020 talk on D3.js came out of this)
- Fast responses to issues in the first months, because early adopters are your marketing
4. Measure the business outcome, not the code
"Reusable framework" convinces engineers. "$500K+ in eliminated licensing spend and faster dashboard delivery across 10+ teams" convinces everyone else. Tracking that number from day one is what turned a side project into a funded platform.
If you're starting something similar today, I'd still choose D3 for the rendering layer, but I'd put more thought into the theming system up front, and I'd write the adoption docs before the second team signs on, not after.