- index.html
Using the data you collected in the last exercise, let’s create the same graph, except this time by writing the code to create the graph yourself!
If you chose to create a graph with a bunch of different categories, then you’ll need to do some extra work to make sure that the code runs correctly:
If you have multiple categories (for example, Florida, Colorado), you will need to add each category to the
categories
variable. To add multiple categories, we can do so by storing all of the categories in a list:categories: ["Florida", "Colorado"],
If you have multiple categories, you will need to store your data a bit differently as well. For each
name
in the series, thedata
attribute should have a piece of data for each category. For example, if we had two categories, Florida and Colorado that had voter data from 2013, then the series data would look like this:series: [ { name: "2013", data: [Florida Data, Colorado Data] }, ]
Whichever category comes first in your
categories
variable should be the data item that you write in first. Since Florida is the first index incategories
, then it should be the first index indata
.
Have fun!
IMPORTANT: In order to see your graph when you run the code, you can’t have blank values in the series. Either fill in the blank values or remove them from the series.
Upload an image
Upload from your computer
Or paste a link here
Slides and Notes
No slides available for this video
About
WebDev