Skip to main content
100%

Input (number) test

✓ Published0🌍 Public
Dd3noob
Last edited Nov 30, 2019
Created on Apr 14, 2014

This example demonstrates how an HTML numeric input controls the rotation of an SVG text element. A `<input type="number">` tag, initialized at 0 with a range of 0–360 and step increments of 5, triggers the D3.js `on("input")` event to update the text’s `rotate` transformation. The rotation angle is displayed in a span beside the input. Rendered as inline SVG using D3 v3.5.17, the text "d3noob.org" is positioned via `translate(300,150)` and dynamically rotated based on user input. The update function recalculates the `attr("transform")` value on each change.

AI-generated description

This is a simple example of implimenting an HTML input using a <number> input tag and using that to adjust a d3.js drawn svg element (rotate text).

It is used as an example and described in the book D3 Tips and Tricks.

mit Licensed

Similar vizzes