Anvil: Web Apps With Nothing but Python Transcripts
Chapter: Charts and graphs
Lecture: Concept: Plotting int anvil

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's just quickly review the two main steps
0:02 of what we did to set up our chart
0:04 and then put data into it.
0:05 Well, first we set it up
0:07 and we did that by just setting a ton of properties.
0:09 We went to the layout, and we did a bunch
0:11 of stuff with layouts at the title, and the X-axis
0:14 and the Y-axis and so on.
0:16 And on the X-axis, we have a bunch of properties
0:18 like the zero line or show the grid
0:20 or mirror should be ticks and things like that.
0:23 You can just go look at different examples
0:26 in the Plotly galleries and find one you like.
0:28 You're like all right, what are the settings on that thing?
0:30 Let me try that.
0:32 And then you want to put your data into the system.
0:34 So we used our data access to go potentially
0:37 to the web service or to cache, local cache
0:39 and get our measurements.
0:41 And if there's none, well, we don't want to try
0:44 to load this up with nothing.
0:46 That might not work so well.
0:47 But we just bail out
0:48 and then we're going to create three variables
0:50 x for the X-axis, h for heart rate
0:54 and w for weight, and then we go through
0:56 and we just build up the X-axis
0:57 the H-axis, and the W-axis from the different parts
1:00 of our data records.
1:02 Then, super simple, we say go to put plot.
1:04 We set the data to be two graph objects
1:07 a scatterplot, and a bar chart
1:09 where we set the X, the Y, and the name.
1:12 That's it. Now we have a beautiful graph that's highly interactive.
1:15 People are going to love it.