1. Learn
  2. /
  3. Courses
  4. /
  5. Building Dashboards with Dash and Plotly

Connected

Exercise

Extending the chain

Your conditional dropdown was a smash hit! That cleaned up the dashboard and provided a much nicer user experience. When demonstrating this product, the stakeholder asked if you could implement a few updates.

Firstly, they wish to select a default value for the minor category so that something always appears on the graph. You have an idea of how to achieve this by inserting an additional chained callback between the first two created.

Secondly, they wish to have a title below the graph that reminds users what major category the chosen minor category belongs to. Rather than another callback, you think this can be achieved by sending the chosen major category to an additional output.

Instructions

100 XP
  • Create a callback below line 37 that is triggered by the major_cat_dd dropdown value and outputs to both the minor_cat_dd dropdown options and the chosen_major_cat_title element.
  • Create another callback below line 52 that sets a default value for the minor_cat_dd dropdown when its options property updates.