Linking bar charts and dropdowns
We now want to put together everything that we've done so far. The plan is to have two dropdowns, side by side, with a chart underneath each. The first will provide years as options that will generate a horizontal bar chart. The second will generate a vertical bar chart, based on the selected country. The end goal is to produce a new section in our app that looks like Figure 5.8:
Let's start by building this as a complete and independent app in JupyterLab, and make sure it works as expected:
- We first run the necessary imports and instantiate the app. We already covered all these imports, except for the
PreventUpdate
exception. This is a useful tool when there is no value selected in a component that is handled by a callback function; for example, when a user first loads the app, or when there are no default...