Update the chart as the reader scrolls
Each paragraph changes the chart as it scrolls into view. One shades 2022, one adds the other indexes, one labels the Nasdaq's 2022 loss and one highlights the index that recovered most. The library animates each change.
Four indexes follow different parts of the US stock market: the 500 largest companies, the technology-heavy Nasdaq, the 30 stocks of the Dow Jones and the 2,000 smaller companies of the Russell 2000. The chart starts with the S&P 500, measured from January 2022 with dividends reinvested.
Over 2022 the S&P 500 lost 18% of its value. In 2023 it gained 26%, enough to finish the year above where it started.
In the spec, this step adds a shaded range for 2022.
The other three fell in 2022 too, by different amounts. The Dow Jones lost 7% over the year, the Russell 2000 lost 21%.
In the spec, this step adds the NASDAQ, Dow Jones and Russell 2000 lines.
The Nasdaq fell furthest, losing a third of its value in 2022. Even after a strong 2023 it finished that year below where it started.
In the spec, this step adds a callout, “Nasdaq, end of 2022: −33%”.
It also climbed furthest. By October 2025 the Nasdaq was up 65% on January 2022, against 46% for the S&P 500, 43% for the Dow and 22% for the Russell 2000.
In the spec, this step highlights NASDAQ and dims the rest.