Skip to main content
100%

Threshold Encoding

✓ Published0🌍 Public
Mmbostock
Last edited Jul 14, 2019
Created on Oct 29, 2012

This line chart displays daily temperature readings over a year, changing color from black to red as the value crosses a 50-degree threshold. A linear gradient with two stops at the same offset creates the hard color break. The visualization uses the D3.js v3 API, including `d3.time.scale`, `d3.scale.linear`, `d3.svg.axis`, and `d3.svg.line`, with data loaded from a TSV file. The SVG rendering applies the gradient to the line path.

AI-generated description

This variation of a line chart demonstrates how to use a linear gradient to change the color of a line based on a y-threshold. This technique is similar to the gradient encoding, but with two stops at the same offset. An alternative method is to draw multiple lines with different colors and different clipping regions.

gpl-3.0 Licensed

Similar vizzes