Preface

I should note here that I’m skipping over a lot here—there’s a ton of awesome stuff you can do with javascript, D3, svgs, and html/CSS more generally, and understanding how all of these play together can be very powerful. But, since we’re just playing around a little today, we’ll stick to just a few basics and I’ve linked a variety of resources at the bottom of the page to learn more!


Set up your html file

When we work in D3 and javascript, we’ll mostly be working in an html envrionment. So for that, we’ll need some very basic tags and formatting. Open a text file and paste the below code chunks into it, then save the file with a ‘.htm’ or ‘.html’ extension.

First, just set up the html and head:

<html>
<head>
<title>Epid 814 D3 Lab</title>

And, we also have to add the D3 library to our setup! We’re using the version at d3js.org here, but you could just reference a local copy too.

<script src="https://d3js.org/d3.v3.min.js"></script>