Skip to main content
100%

Loading US GDP Data with Interactive Color Legend and Line Chart

✓ Published0🌍 Public
SSeekerzero
Last edited Mar 30, 2023
Created on Feb 27, 2023

This interactive visualization displays US GDP data, showing annual levels and percentage changes over time with a line chart. A scatter plot uses color-coded circles to represent each year, grouped into decades via an interactive color legend that highlights or fades data points on hover. The code relies on D3 v7's `scaleTime`, `scaleLinear`, `scaleOrdinal`, `line`, and `axisLeft/axisBottom/axisRight` modules to render the axes and chart. Data is fetched as CSV from the BEA via a GitHub raw URL and parsed with `csvParse` and `timeParse`.

AI-generated description

based on template from professor given, the colored circle represent the year level current ranged for every ten years, and the line represents the level change between each year.

dataset from: https://datahub.io/core/gdp-us

Gross Domestic Product of the United States (US GDP)

Gross Domestic Product (GDP) of the United States (US) both nominal and real on an annual and quarterly basis. Annual data is provided since 1930 and quarterly data since 1947. Both total GDP (levels) and annualized percentage change in GDP are provided. Both levels and changes are available both in current dollars (nominal GDP) and in chained 2009 dollars (real GDP). Data is sourced from US Government’s Bureau of Economic Analysis (BEA) and provided in standardized CSV.

Field Name Order Type (Format) Description
date 1 year The year
level-current 2 number GDP in billions of current dollars
level-chained 3 number GDP in billions of chained 2009 dollars
change-current 4 number GDP percent change based on current dollars
change-chained 5 number GDP percent change based on chained 2009 dollars

MIT Licensed

Similar vizzes