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

Connected

Exercise

Generate key stats on hover

After a recent demonstration of your work with a manager in the e-commerce company, you received a request to create a dashboard for this stakeholder. Having too many visualizations and too much text is absolutely not allowed.

Instead, they want the dashboard to be highly interactive. They have requested a scatter plot that, when hovered over, will provide some additional key stats in a text box to the right. This should change when hovering over a new point on the scatter plot.

Instructions

100 XP
  • Add the 'Country' column to the scatter plot's custom_data parameter below line 8 so it will appear in the hoverData property.
  • Create a callback below line 28 that connects the scatter_fig graph to the text_output element and will be triggered by hovering over the scatter plot.