Skip to main content
100%

Drag Slider

✓ Published0🌍 Public
Mmbostock
Last edited Apr 10, 2017
Created on Sep 5, 2013

This slider example demonstrates interactive color selection by dragging a circular handle along a horizontal track. The handle position maps linearly to hue values from 0 to 180 degrees, updating the SVG background color in real time. Built with D3 v4, it uses `d3.drag` for pointer interaction and `d3.scaleLinear` with clamping. A transition animates the initial hue from 0 to 70 on load, while tick labels show degree values. The visualization renders entirely in SVG, with layered track lines for visual depth.

AI-generated description

This slider is implemented using d3-drag.

See also the smooth variation.

gpl-3.0 Licensed

Similar vizzes