Skip to main content
100%

Drag Slider

✓ Published0🌍 Public
SSpaceActuary
Last edited Jun 19, 2017
Created on Jun 19, 2017

This interactive example demonstrates a slider for selecting a hue value from 0 to 180 degrees, dynamically updating the background color of the SVG canvas. The slider track is overlaid with an invisible, stroke-based capture area that uses the `d3.drag()` API to handle pointer events, converting mouse position to a data value via the inverted linear scale. Tick labels are generated using `x.ticks(10)`, and a white handle with a dark stroke marks the current selection. The visualization opens with a brief, animated transition that uses `d3.interpolate` to smoothly move from 0 to 70 degrees, showcasing the slider’s response.

AI-generated description

This slider is implemented using d3-drag.

See also the smooth variation.

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/6452972'>Drag Slider</a>

gpl-3.0 Licensed

Similar vizzes