Data Science Jumpstart with 10 Projects Transcripts
Chapter: Project 10: Making a Snow Report Dashboard with Dash and Plotly
Lecture: Creating a Plotly Dashboard using Dash with Widgets
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
In this video, I'm going to show you how to make a dashboard with a widget. So here's our code. A lot of this looks the same as what we had before.
0:08
The key difference of this is that we added this drop-down section down below. And you can see that the drop-down has options.
0:16
We're just taking those directly from our pandas data frame. And we're giving that an ID. And then down below that,
0:24
you can see that we have this function called update line graph. There's a decorator. It says app callback.
0:32
And we're saying that the output is to line graph. That's specifying the ID of the figure up above.
0:39
And the input is coming from the year's ID, which is the drop-down. So the year will come in as max year in this function down below.
0:47
And what are we returning? We are returning a plot. This is a plotly plot,
0:52
which will come as the output and will be tied in to the graph as the figure up above. Let's run it and see what happens. Here's the 1990 season.
1:02
You can see that the max goes up to like 110 there. Let's look at the 1993 season. You can see that the max goes up to 98 here.