Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Monday, October 12, 2015

Stacked Area Chart In Javascript

A stacked area chart of transatlantic slave trace made with c3.js and the transatlantic slave trade database

The graph shows the counts for each region the slaves were disembarked by year. The html and javascript for this graph is on a gist here

The data used can be gotten from the slavevoyages.org website with the filters beloew

An actual graph you can play with is here and in the result tab below

Tuesday, March 03, 2015

Tree Rings and Life Expectancy

Andy Kirk here has an interesting blog post on dendrochronology and visualisation literacy.
Here is an example of a tree ring visualisation showing how over time the tree grows and leaves down rings.







I am going to visualise another time series expected lifespan.
Gapminder uses a line graph to visualise life expectancy over time. I downloaded the life expectancy data from gapminder.































The interesting points here are the famine where the life expectancy dropped from an estimated 38.3 to 14.1. Also the 1918 flu epidemic causes an obvious drop from 55.3 in 1917 to 49.68 and back to 55.8 in 1919.
I use this data to create a graph using the code below. The idea is like tree rings except that instead of each line laid down in a particular year each line represents the life expectancy in that year.









































The size of each ring should be a good representation on the number of years people could expect to live in that year. However I just multiplied the years given by Gapminder *6 to give the number of pixels each circles radius should be. A proper visualisation has to be more careful not to distort the number than this. Roughly, living twice as long should look like a tree that is twice as big.

The code to create this graph in a canvas element of a webpage if here. So what do you think, does this visualisation show increase in lifespan in the last 200 years well?