An HTML visualization example

We will visualize World Health Organization (WHO) global life expectancy data in a simple table.

This is available at http://apps.who.int/gho/data/node.main.688 by selecting JSON simplified structure. Save it to your data/ directory (or, if you did git checkout at the start of the chapter, will be in your data/ directory already).

Start off by creating a new file called index.js  inside lib/chapter2 and replacing all the code in main.js with the following:

import lifeExpectancyTable from './chapter2/index'; lifeExpectancyTable();

Add the following to chapter2/index.js:

import tableFactory from './table-factory'; export default async function lifeExpectancyTable() {   const getData = async () => {     try {  const ...

Get D3.js 4.x Data Visualization - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.