Handle Multiple Charts
Terms defined: hidden input
- Generalize what we built in the previous lesson
- Multiple charts, each with its own set of controls
server.py
defines functions to create controls and placeholders for charts- Whatever generates the page must create the right controls
- Whatever serves data must format it for the right kind of chart
- Include a hidden
input
in the form tying it to its chart- Passed to server and returned in data
- Used to select the chart element
static/dashboard.js
has a new functiondisplayAll(…)
- Find all forms with class
controls
and send default settings to server to cause initial display of charts
- Find all forms with class
Run
python server.py --seed 12345
- Go to http://127.0.0.1/5000
- Change the checkboxes
- Click the button to fetch data and redisplay chart