Skip to main content
100%

DomainRangeTinker

✓ Published0🌍 Public
JJoelGallagher
Last edited Oct 18, 2018
Created on Oct 18, 2018

DomainRangeTinker demonstrates how a D3 v4 linear scale converts a percentage value into its decimal equivalent. The example uses `d3.scaleLinear()` with a domain of `[0, 100]` and a range of `[0, 1]`, then computes the scale’s output for an input of 99. The resulting decimal, 0.99, is rendered as text in an SVG element using a monospace font. The code appends a single `<text>` node to the SVG canvas, positioning it at fixed coordinates. This minimal block illustrates the core concept of domain-to-range mapping without any interactive elements or data loading, relying solely on the scale’s transform.

AI-generated description

Built with blockbuilder.org

mit Licensed

Similar vizzes