🌍 Public
Viewing a saved revision (read-only)
f55bf5c7087f408b80df6168e5aaf7f7
Fork of Loading Data - Crop Yield
This example demonstrates loading and displaying crop yield data from a CSV file, showing raw parsed values for crops like maize and potatoes across multiple years in Afghanistan. The visualization initially renders a JSON representation of the dataset, then transitions to a structured table after the asynchronous fetch completes. Using `d3.csvParse` and `d3.select`, the code reads the remote CSV, converts numeric fields such as `Year_Code` and `Value` to numbers, and updates the DOM with the processed data. The state management via `setState` triggers re-rendering as data moves from an initial `undefined` state through `'LOADING'` to the final parsed array.
AI-generated description