Simple Difference Chart v5
This difference chart shows the daily change in Leanpub book sales for two titles, “R Programming for Data Science” and “The Elements of Data Analytic Style,” over time. The difference between the two series is filled in with orange above zero and green below zero, using clipped areas. The code uses D3 v5’s APIs including `d3.scaleTime`, `d3.scaleLinear`, `d3.axisBottom`, `d3.area`, and `d3.nest` to structure the CSV data. The chart renders as an SVG, with lines for each series drawn via `d3.area` and `d3.curveBasis`.
AI-generated descriptionThe graph above shows a simple example of a difference chart used as an example in the book D3 Tips and Tricks. It is based on the difference chart example produced by Mike Bostock.
The graph shows the difference in the number of daily downloads between R Programming for Data Science by Roger Peng and The Elements of Data Analytic Style by Jeff Leek