Assignment 6: Visualizing Data from an API

Due: Tuesday, 11/3/26, before class.

Goal

For this assignment, you'll get data from an API and then do something interesting with it using a front-end library. What "interesting" means is up to you: a chart that compares things in a way that tells you something, a p5.js sketch where the data becomes the characters, sizes, and colors of a drawing, an animation, even a small game.

The main thing I'm looking for is that the library is working with the data you fetched, so that the data is what decides what shows up on the page. For example, a chart built from numbers you typed in yourself, or a p5.js sketch that sits next to some text from an API without using it, would miss the point of the assignment.

Data Sources

You can pick any one of these. They're all free and don't need an API key or sign-up, and each name links to that API's documentation. Before you start writing code, it helps to open the URL in a browser tab and look at the JSON it sends back.

If you'd like to use a different API, check with me first. It needs to work without a key, and some APIs block requests from web pages, so it's worth making sure it'll work before you build on it.

Libraries

p5.js and Chart.js are the recommended ones, and they're what we use in class.

Requirements

  1. Use a front-end library, loaded from a CDN
    p5.js or Chart.js (or something else that does real work with the data). Load it with a <script> tag, before your own script.js. For p5.js and Chart.js, use these exact versions so your code matches the docs and the class demos:
    <script src="https://cdn.jsdelivr.net/npm/chart.js@4.5.1/dist/chart.umd.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/p5@2.3.4/lib/p5.min.js"></script>
  2. Fetch data from one of the data sources
    Use fetch with async/await to get data from one of the APIs in Data Sources above.
  3. The data drives the visualization
    Pull specific values out of the JSON and use them as inputs to the library: the bars or points on a chart, or the sizes, colors, and positions of things in a p5.js sketch. Your visualization should use at least two different values from the data (for example, a Pokémon's attack and defense, or a film's score and its year).
  4. Code comments
    Add your own HAND-WRITTEN code comments explaining what is happening in your code.
  5. BONUS: A way to change what's shown
    Controls (a <select>, buttons, a text box) that makes a new request and updates the visualization without reloading the page. For example: a different Pokémon, a different character, the next page of dog breeds.

Things That Will Trip You Up

File and Folder Setup

Same rules as before: folder and file names must match exactly. Your files go in a new 06-api-visualization folder:

csc336-fall2026/
└── assignments/
    └── 06-api-visualization/
        ├── index.html
        ├── style.css
        └── script.js

Once pushed, your assignment will be visible at:
https://<your-username>.github.io/csc336-fall2026/assignments/06-api-visualization/

A Note on Generative AI

Do not use ChatGPT, Copilot, Claude, or any other generative AI tool to write any part of this assignment. Whatever you do, remember that your goal should be to understand 100% of the code that you turn in.

What to Submit

Nothing to submit directly. Your assignment should be publicly available at the address in File and Folder Setup above once you've committed and pushed.