Radar
capability scoring
Capability scoring across axes. Fine for one subject, misleading with four overlaid.
- Format.d3
- Length83 lines
- Includesnone
The source
83 lines of D3 JavaScript, and uses only the bundled D3 build. Copy it, or open the template inside Gnomon and render it as it is.
// Radar chart — several subjects scored on the same axes.
// Honest caveat: area is not meaningful (it changes with axis order), so use
// it for shape comparison, not for "which is bigger".
const axes = ['Security', 'Scalability', 'Cost', 'Usability', 'Observability', 'Portability'];
const subjects = [
{ name: 'Current state', values: [2, 2, 3, 3, 1, 2] },
{ name: 'Target state', values: [5, 4, 3, 4, 5, 4] },
{ name: 'Vendor A', values: [4, 5, 2, 3, 4, 2] },
];
const MAX = 5;
const radius = Math.min(width, height) / 2 - 90;
const angle = i => (i / axes.length) * 2 * Math.PI - Math.PI / 2;
const r = d3.scaleLinear().domain([0, MAX]).range([0, radius]);
const color = d3.scaleOrdinal(subjects.map(s => s.name), theme.palette);
const svg = d3.select(container).append('svg')
.attr('viewBox', [-width / 2, -height / 2, width, height])
.attr('width', width)
.attr('height', height)
.attr('font-family', 'system-ui, sans-serif')
.attr('font-size', 11);
svg.append('g')
.attr('fill', 'none')
.attr('stroke', theme.muted)
.attr('stroke-opacity', 0.25)
.selectAll('circle')
.data(d3.range(1, MAX + 1))
.join('circle')
.attr('r', d => r(d));
svg.append('g')
.attr('stroke', theme.muted)
.attr('stroke-opacity', 0.35)
.selectAll('line')
.data(axes)
.join('line')
.attr('x1', 0).attr('y1', 0)
.attr('x2', (_, i) => Math.cos(angle(i)) * radius)
.attr('y2', (_, i) => Math.sin(angle(i)) * radius);
svg.append('g')
.attr('fill', theme.foreground)
.attr('text-anchor', 'middle')
.selectAll('text')
.data(axes)
.join('text')
.attr('x', (_, i) => Math.cos(angle(i)) * (radius + 22))
.attr('y', (_, i) => Math.sin(angle(i)) * (radius + 22))
.attr('dy', '0.35em')
.text(d => d);
// curveLinearClosed joins the last point back to the first; without it the
// polygon has a gap at 12 o'clock.
const line = d3.lineRadial()
.curve(d3.curveLinearClosed)
.angle((_, i) => (i / axes.length) * 2 * Math.PI)
.radius(d => r(d));
svg.append('g')
.selectAll('path')
.data(subjects)
.join('path')
.attr('d', d => line(d.values))
.attr('fill', d => color(d.name))
.attr('fill-opacity', 0.15)
.attr('stroke', d => color(d.name))
.attr('stroke-width', 2);
const legend = svg.append('g')
.attr('transform', `translate(${-width / 2 + 16},${-height / 2 + 20})`);
legend.selectAll('g')
.data(subjects)
.join('g')
.attr('transform', (_, i) => `translate(0,${i * 18})`)
.call(g => g.append('rect')
.attr('width', 11).attr('height', 11).attr('rx', 2)
.attr('fill', d => color(d.name)))
.call(g => g.append('text')
.attr('x', 16).attr('y', 9)
.attr('fill', theme.foreground).text(d => d.name));Render this offline
This template ships in Gnomon and renders on your machine, with no account and nothing sent to a server. The browser editor is free and needs no install.
Others in D3 visualisations
- Sankey — request flowFlow with volume. The best chart here for "where does it all go".
- Chord — service interactionWho talks to whom, when the traffic is bidirectional.
- Arc diagram — dependenciesNodes on one axis, arcs above. Readable where a force graph is not, provided the ordering means something.
- Adjacency matrix — couplingAdjacency matrix. Unfashionable, and better than a force graph for dense dependencies.
- Edge bundling — module importsHierarchical edge bundling. For import graphs big enough that straight edges become a hairball.
- Sunburst — nested spendNested hierarchy, radially. Prettier than an icicle, harder to compare.
- Icicle — nested spend (linear)A sunburst unrolled flat. Harder to love, much easier to compare siblings.
- Circle packing — nested sizeCircle packing. Nested size when the nesting matters more than reading exact areas.
- Treemap — portfolio costNested size. Good for cost, storage, lines of code.
- Tidy tree — structureA tidy tree. The default for anything with one parent per node.
- Radial tree — structure (radial)The same tree bent into a circle. Fits more depth on a slide, costs you easy comparison.
- Dendrogram — clusteringClustering, with join height carrying the distance. Not merely a tree with curves.
- Indented tree — file/spec outlineA file or spec outline. The chart that looks like the thing it describes.
- Force graph — service mapService map. Use for clusters, not for reading individual edges.
- Force graph — disjoint clustersForce graph that keeps unconnected clusters apart rather than flinging them off screen.
- Force graph — radial tiersForce layout pinned to rings, so tier is a position instead of a colour legend.
- Directed graph — call directionDirected edges with arrowheads. For when direction is the question, not just adjacency.
- Force tree — blast radiusBlast radius from one node: what breaks if this goes.
- Calendar heatmap — daily activityDaily activity over a year: deploys, incidents, commits.
- Streamgraph — shifting mixShifting composition over time. Good for the mix, poor for reading any single value.
- Gantt — delivery roadmapDelivery roadmap, rendered from data.
- Bullet chart — target vs actualTarget against actual, in one line. The chart a gauge wishes it were.
- Beeswarm — distribution by groupEvery point, grouped, without the overplotting a strip plot suffers.
- Horizon chart — many series, little spaceMany series in little space. Takes a moment to learn, then very dense.
- Slope chart — before and afterBefore and after, two points, one line each. Devastatingly clear.
- Parallel coordinates — multi-criteriaMulti-criteria comparison: for option analysis.
- Box plot — latency distributionLatency distribution. The chart that shows the tail a mean hides.
- Grouped bar — category comparisonCategory comparison. Unglamorous, and usually the right answer.
- Multi-line — metrics over timeMetrics over time. Keep it under about five series, or switch to horizon.