Skip to main content
100%

d3 donut with legend horizontal

✓ Published0🌍 Public
Aallyraza
Last edited Nov 26, 2017
Created on Nov 22, 2017

A d3.v4 donut chart displays three categorical values as proportional arcs, each colored via `d3.scaleOrdinal` with the `d3.schemeCategory20b` palette. Below the donut, a horizontal legend places colored squares and text labels, dynamically positioned using each label’s `getBBox()` width to avoid overlap. The chart uses `d3.pie` and `d3.arc` to generate the SVG paths, with margins configured around a 400×300 pixel canvas. Data is hardcoded as objects with `label` and `value` properties, and the visualization is rendered entirely with SVG elements in the browser.

AI-generated description

Built with blockbuilder.org

mit Licensed

Similar vizzes