1Introduction
- 1.1Prerequisites
- 1.2What you’ll learn
- 1.3What you’ll build
- 1.4Code download
- 1.5Where to get help
- 1.6Stay in touch
- 1.7Translators
- 1.8Acknowledgements
2Energy Explorer
- 2.1Technical overview
- 2.2Overview of the Energy Explorer build
3Practical: Setting Up
- 3.1What you need
- 3.2Get set up
- 3.3Summary
4Introduction to D3
- 4.1Joining data with D3
- 4.2D3 modules
- 4.3D3 versions
5Requesting Data with D3
- 5.1d3.csv
- 5.2d3.tsv
- 5.3d3.dsv
- 5.4d3.json
- 5.5CSV, TSV or JSON?
- 5.6Static resources and APIs
6Practical: Load the Data
- 6.1Overview
- 6.2Inspect the data
- 6.3Include JavaScript files in index.html
- 6.4Request data
- 6.5Summary
7D3 Selections
- 7.1Creating a selection
- 7.2Updating a selection’s elements
- 7.3Multiple updates
- 7.4Chained selections
8Data Joins
- 8.1Creating a data join
- 8.2Updating the joined elements
- 8.3Joining arrays of objects
9Practical: Draw the Data
- 9.1Overview
- 9.2Add a container for the circles
- 9.3Join the data array to circle elements
- 9.4Save and refresh
10Scale Functions
- 10.1scaleLinear
- 10.2scaleSqrt
- 10.3Putting scale functions to use
11Practical: Size the Circles
- 11.1Overview
- 11.2Convert indicator values from strings into numbers
- 11.3Create a sqrtScale function and set the circle radii
12Architecture for Web-based Data Visualisation
- 12.1Layout functions
- 12.2Modules
13Practical: Add Modules
- 13.1Overview
- 13.2Add new modules
- 13.3Add a layout function
- 13.4Move update code
- 13.5Use layout function
- 13.6Save and refresh
14Arranging Items in a Grid
15Practical: Arrange the Data
- 15.1Overview
- 15.2Add configuration object
- 15.3Modify layout function
- 15.4Save and refresh
- 15.5Summary
16The Build So Far
17More on D3 Selections
- 17.1More selection methods
- 17.2Update functions
- 17.3Summary
18More on D3 Joins
- 18.1Joining an array to groups of elements
- 18.2Nested joins
19Practical: Add Labels
- 19.1Overview
- 19.2Add label information to layout.js
- 19.3Modify update function to join data to
<g>elements - 19.4Center the labels using CSS
- 19.5Summary
20Practical: Add More Circles
- 20.1Overview
- 20.2Add properties for each energy type in the layout function
- 20.3Add four circles in the update function
- 20.4Style the circles
- 20.5Save and refresh
- 20.6Summary
21Practical: Style the Circles
- 21.1Overview
- 21.2Design a colour scheme
- 21.3Style the circles
- 21.4Center the visualisation
- 21.5Change the background colour
- 21.6Save and refresh
- 21.7Summary
22D3 Event Handling
- 22.1Event types
- 22.2the ‘this’ keyword in the event handler
23Flourish Popup Library
- 23.1Installing the popup
- 23.2Initialising the popup
- 23.3Popup methods
- 23.4Popup styling
- 23.5Example
24Practical: Add a Popup
- 24.1Overview
- 24.2Link to the popup library
- 24.3Add new module for popup
- 24.4Add event handlers
- 24.5Populate popup with energy data
- 24.6Offset the popup
- 24.7Summary
25State Management
- 25.1State management example
- 25.2Summary
26Practical: Add State Management
- 26.1Overview
- 26.2Add a new module
- 26.3Add an empty state object and action function
27Practical: Add a Menu
- 27.1Overview
- 27.2Add a container for the menu
- 27.3Add selectedIndicator state property
- 27.4Add a new module for the menu
- 27.5Add code to construct and manage the menu
- 27.6Basic styling of the menu
- 27.7Call updateMenu from update function
- 27.8Summary
28Data Manipulation
- 28.1Installing Lodash
- 28.2Lodash syntax
- 28.3_.uniq
- 28.4_.includes
- 28.5_.without
- 28.6_.filter
- 28.7_.sortBy
- 28.8_.orderBy
- 28.9Summary
29Practical: Sort the Countries
- 29.1Overview
- 29.2Link to Lodash
- 29.3Sort the data
- 29.4Hide countries with a zero or missing value
- 29.5Summary
30D3 Transitions
- 30.1Creating D3 transitions
- 30.2Transition duration
- 30.3Transition delay
- 30.4Key functions
- 30.5Summary
31Practical: Add Transitions
- 31.1Overview
- 31.2Add a key function to the data join
- 31.3Add transition to the country groups
- 31.4Add transition duration and delay
- 31.5Initialise the country group positions
- 31.6Add a transition to the circle radii
- 31.7Summary
32Practical: Add a Legend
- 32.1Overview
- 32.2Add the legend to index.html
- 32.3Add a function to update the radius of the legend circle
- 32.4Style the legend
- 32.5Summary
33Practical: Finishing Touches
- 33.1Overview
- 33.2Add and apply Open Sans font
- 33.3Style the menu
- 33.4Add header and footer
- 33.5Other CSS tweaks
- 33.6Summary
34Wrapping Up
- 34.1Where next?
- 34.2Wrapping up
Appendix A: Tools and Set-up
- Web development tools
Appendix B: Example Set-Up
- Create a project directory
- Install a code editor
- Create a minimal HTML file
- Install Live Server extension
- Start Server
- Add CSS and JavaScript files
- Summary
