Skip to main content
100%

Area graph with gradient in v6

✓ Published0🌍 Public
Dd3noob
Last edited Sep 14, 2020
Created on Sep 14, 2020

This example shows an area graph with a vertical gradient fill that transitions through red, black, and green bands, making the change in closing stock prices visually distinct. The gradient is defined using an SVG `linearGradient` element with `gradientUnits` set to userSpaceOnUse, and its stops are bound to explicit color and offset data. The area path is rendered with `d3.area()` using time-scaled x and linear-scaled y axes, while data from `data.csv` is parsed with `d3.timeParse`. Axes are drawn via `d3.axisBottom` and `d3.axisLeft`.

AI-generated description

This is a graph demonstrating the implimentation of a gradient on an area graph.

This graph is part of the code samples for the update to the book D3 Tips and Tricks to version 6 of d3.js.

mit Licensed

Similar vizzes