Skip to main content
100%

Line graph with gradient in v4

✓ Published0🌍 Public
Dd3noob
Last edited Aug 15, 2016
Created on Aug 15, 2016

This example shows a line graph of stock closing prices over time, with the line colored by a vertical gradient that shifts from red to black to green based on price levels. The visualization uses d3.v4 to load CSV data, parse dates with `d3.timeParse`, and render an SVG path via `d3.line`. A `linearGradient` with multiple stop points is applied to the line’s stroke, and axes are added using `d3.axisBottom` and `d3.axisLeft`. The data is drawn from `data.csv` containing date and close values.

AI-generated description

This is a simple graph demonstrating the implimentation of a gradient on the line in a line graph. This was written using d3.js v4 and is a follow on to the simple graph example here.

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

Similar vizzes