Anvil: Web apps with nothing but Python Transcripts
Chapter: Charts and graphs
Lecture: Introducing charting in Anvil

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Because our application gathers a bunch
0:02 of measurements, a really nice way
0:03 to display these back to the user
0:06 would be a chart.
0:07 That way they could quickly see what their weight
0:11 or their health is over time.
0:13 So that's what we're going to do in this chapter.
0:14 We're going to create some graphs, some charts
0:16 right on the homepage.
0:17 When people log in, just going to land there and see them.
0:21 But what are we going to use?
0:22 Well, there's a lot of options in Python
0:24 for building really rich, interactive plots in the web.
0:28 One of those is Plotly.
0:30 So here's a really cool graph.
0:31 You can see the life expectancy versus
0:34 per capita GDP from 2007, and what's really nice
0:38 is it's not just a picture.
0:40 You can move around this little red boxes
0:42 when you hold the mouse over, I guess the part
0:45 that's United States, and you can see the different colors
0:48 in areas and so on.
0:49 And also, see that toolbar up at the top?
0:51 You can zoom in, you can pan, you can do all kinds
0:54 of stuff on these graphs
0:56 so they're very, very interactive.
0:57 And in Anvil, it's super easy.
0:59 All you have to do is go over to your toolbox
1:01 grab this little bar chart-looking thing
1:04 bar graph-looking thing, and drag it over
1:06 and then configure it, and it automatically
1:08 brings Plotly into your web app.
1:11 So that's what we're going to do in this chapter
1:12 for our weight and our resting heart rate.