Setting up traditional HTML components
In order to understand the power and flexibility of D3, it would make sense to first understand an example of leveraging HTML without it.
Adding a new paragraph the traditional way
Adding a new paragraph to the body of the HTML page is pretty straightforward. All that is necessary is to include two <p>
tags with with the appropriate name of the paragraph, as seen in the following script:
<!DOCTYPE html> <html> <head> <script src="d3.js" charset="utf-8"></script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>First Example</title> </head> <body> <p>This is our first example</p> </body> </html>
Besides adding a new paragraph, we also changed the title of this page to First Example. When viewing the HTML page inside of the browser, the following should appear:
Note
Anytime we wish to view our HTMLÂ file, we...