D3
Rationale
D3.js and Billboard.js are used to render pre-computed analytics in the platform dashboard.
The main reasons why we chose them over other alternatives are:
- They are open source .
- D3 is the de facto standard for data-driven documents
and gives full control over rendering and DOM;
generators use it for selection and layout
(e.g.,
d3.select,d3.selectAll). - Billboard.js is built on D3 and provides ready-made chart types (line, bar, stacked bar, etc.) that match our needs and reduce custom code.
- The stack fits our analytics pipeline: pre-computed data is stored, then served to the front end; no server-side chart rendering is required.
- Charts run in the browser from static JSON produced by generators.
Alternatives
The following alternatives are being considered:
Chart.js
- Chart.js is a popular, lightweight charting library.
- The current stack (D3 and Billboard) better matched our need for DOM control in generator scripts and ready-made chart types.
Evidence.dev
- Evidence.dev is an open-source BI framework (Markdown + SQL) and could leverage Snowflake, which we already use.
- Using it would require a different architecture (report server, embedding).
Apache ECharts
- Apache ECharts offers many chart types and is another option worth considering.
- We stayed with D3 and Billboard for their smaller API surface and existing generator integration.
Usage
We use D3.js and Billboard.js to render analytics in the platform:
- Pre-computed chart data is loaded from storage and sent to the client.
- The front end loads D3 and Billboard and runs chart the generator logic for each visualization.
- Generators consume the data and use D3 and Billboard to draw the chart on the page.
Last updated on