Skip to main content
100%

HTML Starter

✓ Published0🌍 Public
DDavid
Last edited Oct 26, 2020
Created on Oct 26, 2020
Forked from HTML Starter

This example shows a single vertical bar whose fill color transitions through a five-stop gradient from red to green, with the bar’s height fixed and width constant. The data array contains one number (39) that currently does not affect the bar’s dimensions, despite the readme suggesting otherwise. The code uses d3.select and append to create an SVG, then builds a linearGradient with d3’s data join, binding the colors array to stop elements. The bar is a rect with a fill referencing the gradient, rendered against a light gray background.

AI-generated description

I have created a simple code example for you. Hope this helps:)

If you change the data, you will see that the color and size of th bar change accordingly

MIT Licensed

Similar vizzes