block by mbostock 3970883

Threshold Encoding

Full Screen

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.

Updated Example →

index.html

data.tsv