More Table Madness
Learn how to sort, prettify, and add columns to the tables used with your graph.
We'll cover the following
Sorting, prettifying, and adding columns
When we last left our tables, they were happily producing a faithful list of the data points that we had in our graph.
But what if we wanted more?
Add another column of information
Firstly, let’s add another column of data to our table. To do this, we want to have something extra in our CSV file to use, so let’s resurrect our old friend data2.csv that we used for the graph with two lines previously. All we have to do to make this a reality is change the reference that loads data.csv
to data2.csv
here:
d3.csv("data2.csv").then(function(data) {
From here, it’s just a matter of adding in the extra column you want (in this case, it’s the open
column) like so:
var peopleTable = tabulate(data, ["date", "close", "open"]);
Get hands-on with 1400+ tech skills courses.