Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

D3 data loading

Public visualization

D3 data loading

0 stars2🌍 Public
SSubhendu Karmakar
Last edited Jan 22, 2024
Created on Jan 22, 2024
Forked from D3 Starter

This example demonstrates asynchronous data loading in D3 by fetching a CSV file of iris flower measurements (`data.csv`) and displaying the parsed content as a JSON string inside a `<pre>` element. While the request is pending, the text shows “LOADING” before replacing it with the data. Using `d3.csvParse` alongside the `fetch` API, the code converts text into an array of objects, then coerces numeric fields such as `sepal_length` and `petal_width` into numbers with the unary plus operator. The visualization relies on D3 v7 selections with `.join()` to update the DOM, while `index.js` manages a simple state pattern.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed