Line simplification

Tom Pearson November 2015

Simplified data

Original data

Tolerance: 3

A simplified path generator for D3. Remove points without losing much information. A drop in replacement for d3.svg.line with the added ability to specify a tolerance.

In the case above:

var simple = simplePath()
	.x(function(d){ return dateScale(; })
	.y(function(d){ return valueScale(d.value); })

Based on Simplify.js a tiny high-performance JavaScript polyline simplification library by Vladimir Agafonkin, extracted from Leaflet, a JS interactive maps library by the same author.

It uses a combination of Ramer-Douglas-Peucker and Radial Distance algorithms.

Source code is on GitHub