Exercise

Fixing a broken dashboard

Oh no! While transferring your interactive sales dashboard to production, the file was corrupted. Most of the file was able to be recovered; however, there are some crucial functions and elements that have gaps, largely around the triggered callback function.

Can you use your knowledge of Dash callbacks to fix this dashboard?

Instructions

100 XP
  • Set up a default value for the country_filter to be 'All Countries' below line 48 so this appears on page load.
  • Ensure that the ecom_sales DataFrame is not overwritten inside the triggered function whenever there is user interactivity below line 50.
  • Create a conditional that is triggered if there is user interactivity, which then filters the sales DataFrame below line 52.
  • Return the appropriate object from the triggered function below line 60, so the Plotly figure is re-rendered.