Chapter 05 · Dart + browser APIs
Axes, bars, and arc wedges.
Generate bar and pie charts from one JSON document. Dart computes scales, ticks, positions, labels, and SVG arc paths.
SVG bar chart
SVG pie chart
Loading the Dart application…
How it works
The HTML is a static template. JSON supplies values or drawing data. Dart owns rendering and browser events; boot.js registers small JavaScript handlers through LMDart.register.
final data = await fetchJson('data/chart.json');
renderBarChart(barContainer, data['bar']);
renderPieChart(pieContainer, data['pie']);