Skip to main content
100%

Fork of D3 Starter

✓ Published0🌍 Public
謝謝惠喻
Last edited Oct 15, 2023
Created on Oct 15, 2023
Forked from D3 Starter

This example demonstrates a straightforward color legend using D3's ordinal scale, displaying three categories—blueberries, oranges, and apples—each assigned a color from the `d3.schemeCategory10` palette. The visualization renders swatches and labels via the `Swatches` function, which builds an HTML structure with inline styles for swatch dimensions and text formatting. The code imports `select` from D3 and applies the `swatches` helper to generate the legend, relying on D3 v7 loaded from a CDN. The page itself is minimal, centering the legend with a large font size, showcasing a simple starter template for D3-based data displays.

AI-generated description

A demonstration of how to start using D3 version 6.

MIT Licensed

Similar vizzes