Session Ready
Exercise

Finance line chart with custom time buttons

You have been engaged by an Excel-savvy finance trading company to help them jazz up their data visualization capabilities. Safe to say, Excel graphics aren't cutting it for them!

The fund is particularly interested in the electric vehicle company Tesla and how it has performed this year and wants a tool that can help them zoom to view key timeframes.

In this exercise, you will help the trading company by visualizing the opening stock price of Tesla over 2020 and create the following date-filter buttons:

  • 1WTD = The previous week (7 days to date)
  • 6MTD = The previous 6 months week (6 months to date)
  • YTD = The current year to date

You have a tesla DataFrame available that contains the necessary data.

Instructions
100 XP
  • Create a basic line chart of the tesla DataFrame using the Date and Open columns.
  • Create a list called fin_buttons containing the custom date-filter buttons mentioned above.
  • Update the figure using .update_layout() to construct buttons using the list you just created.