Skip to main content
100%

d3js Exercice 2 - Scales

✓ Published0🌍 Public
YYannLive
Last edited Oct 10, 2017
Created on Oct 10, 2017

This example demonstrates how D3.js scale functions map input domain values to output range values, printing results directly to the page. It uses `d3.scaleLinear()` to transform numbers between 0 and 20 into a range of 0 to 1, showing outputs for boundary and mid-point inputs. The code then applies the `.clamp(true)` method to restrict output values beyond the specified domain, so inputs like -10 and 200 return clamped results. Written in French comments, it also suggests experimenting with `invert`, `power`, `log` scales, and color ranges. The visualization is purely text-based, using `document.writeln` to display results in a `<pre>` element.

AI-generated description

d3js Exercice 2 - Scales

forked from <a href='http://bl.ocks.org/AlainRo/'>AlainRo</a>'s block: <a href='http://bl.ocks.org/AlainRo/d7b7518300065d666827b39460745b26'>d3js Exercice 2 - scales</a>

mit Licensed

Similar vizzes