Skip to main content
100%

Difference Chart

✓ Published0🌍 Public
SSpace23
Last edited Oct 10, 2017
Created on Oct 10, 2017

This example shows a difference chart comparing daily temperatures in New York and San Francisco, with the gap between the two lines shaded green when New York is warmer and red when San Francisco is warmer. The visualization uses D3 v4’s `d3.area`, `d3.line`, and `d3.scaleTime` to render the SVG paths, while `clipPath` elements with `area.y0` values clip the colored regions based on which city has the higher temperature. The data is loaded from a TSV file containing date and temperature values for both cities.

AI-generated description

Difference Chart

A v4 update to <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/3894205'>Difference Chart</a>

This variation of a bivariate area chart uses clipping to alternate colors. When New York is warmer than San Francisco, the difference between the two is filled in green. When San Francisco is warmer, the difference is filled in red. A similar technique was used by William Playfair all the way back in 1786.

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/3894205'>Difference Chart</a>

forked from <a href='http://bl.ocks.org/alexmacy/'>alexmacy</a>'s block: <a href='http://bl.ocks.org/alexmacy/67a5211cf2c5cbda74501ce36d85ba4c'>Difference Chart v4</a>

forked from <a href='http://bl.ocks.org/AlainRo/'>AlainRo</a>'s block: <a href='http://bl.ocks.org/AlainRo/a13b672ef688bf238568ca7aa42dde15'>Difference Chart v4</a>

mit Licensed

Similar vizzes