Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering SVG

You're reading from   Mastering SVG Ace web animations, visualizations, and vector graphics with HTML, CSS, and JavaScript

Arrow left icon
Product type Paperback
Published in Sep 2018
Publisher Packt
ISBN-13 9781788626743
Length 312 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Rob Larsen Rob Larsen
Author Profile Icon Rob Larsen
Rob Larsen
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Introducing Scalable Vector Graphics FREE CHAPTER 2. Getting Started with Authoring SVG 3. Digging Deeper with SVG Authoring 4. Using SVG in HTML 5. Working with SVG and CSS 6. JavaScript and SVG 7. Common JavaScript Libraries and SVG 8. SVG Animation and Visualizations 9. Helper Libraries Snap.svg and SVG.js 10. Working with D3.js 11. Tools to Optimize Your SVG 12. Other Books You May Enjoy

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:

  1. We will take the data and get the total number of years, the total number of home runs...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime