D3.js First Steps
For now, you will just use a text file and the web browser. You will start with with a static page of HTML. Then you will add d3.js.
Create a folder named d3js_projects. Create an HTML file in the folder named project_1.html.
Start with a basic HTML webpage:
1<!DOCTYPE html> 2<html> 3 <head> 4 </head> 5 <body> 6 <p>Hello!</p> 7 </body> 8</html>
Which shows up in the browser:
Source File Setup Test
To test our D3.js setup we open the inspect element tool kit.
In the Element tab of the Webkit Inspector, we open all of the elements so that we can see the whole HTML structure.
We then hover over the d3.vs.min.js src.
When we click on the link, it takes us to the sources tab. This will show the D3.js minified code.
In this snapshot, locate the "Console" tab in the Webkit Inspector:
This will cause a popup alert to pop up and say "Hello!". This is what it looks like:
Now to test if D3.js is loaded correctly. Type a lowercase "d3" into the Console followed by a period:
If we have D3.js installed correctly, the following should appear:
If all the tests passed and you were able to load D3.js correctly, you are ready to get started.