SVG vs Canvas D3
This example compares the performance of rendering 20,000 lines using SVG versus Canvas in D3 v4. It demonstrates both discrete diverging color scales with `d3.scaleThreshold` and `d3.schemePuOr`, and continuous diverging scales with `d3.scaleSequential` and `d3.interpolatePuOr`. Two buttons trigger drawing with either approach, and each displays the elapsed time via the `performance.now()` API. The SVG version appends individual `<path>` elements, while the Canvas version draws directly to a 2D context and overlays an SVG axis.
AI-generated descriptionAn example to ilustrate the difference of using d3.scaleThreshold vs d3.scaleSequential for creating discrete vs continuous diverging scales using d3.v4 and d3-scale-chromatic
See also sequential scales
Built with blockbuilder.org
forked from <a href='http://bl.ocks.org/john-guerra/'>john-guerra</a>'s block: <a href='http://bl.ocks.org/john-guerra/17fe498351a3e70929e2e36d081e1067'>Discrete vs continuous diverging scales with d3-scale-chromatic</a>
forked from <a href='http://bl.ocks.org/john-guerra/'>john-guerra</a>'s block: <a href='http://bl.ocks.org/john-guerra/e80f02e59681ace122626c39407526a0'>SVG vs Canvas D3</a>
forked from <a href='http://bl.ocks.org/anonymous/'>anonymous</a>'s block: <a href='http://bl.ocks.org/anonymous/e63f80dde0c765c74e9ac491db5cea9a'>SVG vs Canvas D3</a>