Creating an SVG data visualization
This first section is going to focus on putting together a basic data visualization using SVG and JavaScript. This particular visualization will focus on an illustration, the positive/negative variance from an average. In this case, it will illustrate the number of home runs hits, per season, by the baseball player David Ortiz in his career with the Boston Red Sox compared with his average number of home runs over his Red Sox career.
From 2003 until 2016 David Ortiz hit a minimum of 23 and a maximum of 54 home runs in a season while playing for the Red Sox. He averaged 34.5 per season. This visualization will show the relative positive/negative variance of his home run totals for every year against that 34.5 average. Years in which he hit more than the average will be in green. Years, where he hit less, will be in red.
The steps we'll need to go through are as follows:
- We will take the data and get the total number of years, the total number of home runs...