🌍 Public
Viewing a saved revision (read-only)
adc34c386e384d35a8f2bfa5afeeaa1a
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