Skip to main content
100%

Color via Clipping

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Nov 12, 2012

A line chart displays daily temperatures over several months, with the line split into two colors—red above a 55°F threshold and black below. The D3 v3 SVG implementation uses clipping paths (`clipPath` and `rect`) to divide the drawing area, applying each clip to a separate line path rendered from the TSV data via `d3.svg.line`. The `d3.time.scale` and `d3.svg.axis` handle temporal positioning and axes.

AI-generated description

This variation of a threshold encoding demonstrates how to use clipping to change the color of a line based on a y-threshold.

gpl-3.0 Licensed

Similar vizzes