Skip to main content
100%

Graph and table with tricks in v4

✓ Published0🌍 Public
Dd3noob
Last edited Aug 17, 2016
Created on Aug 17, 2016

This example combines a line chart with an interactive HTML table, both generated from the same CSV dataset. The line chart plots the closing values over time using D3’s time-scaled x-axis and linear y-axis, while the table displays the raw date, close, open, and computed difference columns. The table’s rows are sorted by descending close value, and the column headers are capitalized automatically. The chart is drawn as an SVG path using `d3.line`, with axes created via `d3.axisBottom` and `d3.axisLeft`. The table is built with the D3 selection API, appending `table`, `thead`, and `tbody` elements to the page body.

AI-generated description

This is a simple graph demonstrating the addition of a table with several 'tricks' and a graph (open in full screen to see the table). This was written using d3.js v4 and is a follow on to the simple graph with table example here.

This graph is part of the code samples for the update to the book D3 Tips and Tricks to version 4 of d3.js.

Similar vizzes