Anvil: Web apps with nothing but Python Transcripts
Chapter: Charts and graphs
Lecture: Finishing the no-data story
0:00 All right. Our app is looking really good.
0:01 We saw we can get this chart looking fantastic.
0:05 Another thing going on, though
0:06 down here, that's not great is we can show this.
0:10 Alright. Let's actually go and test that.
0:12 Let's in here and set that to be empty.
0:17 All right. Here's our spot where it says
0:19 Hey, there's no data. Maybe you should go add some.
0:22 Well, this is an encouraging button
0:25 but it's behavior is not so encouraging.
0:28 We just need to take them here
0:29 over to add measurement, right?
0:31 That would be great. How do we do that?
0:33 Well, it turns out to be super easy.
0:35 Do we have navigation imported? Not yet.
0:39 Remember we wrote this navigation thing
0:41 specifically so all these components' controls
0:44 can use the navigation stuff
0:45 without knowing or caring about it.
0:48 So let's go to our design
0:50 do the double-click on that thing.
0:52 And then, all we've got to do down here
0:54 we want to go home, is we say, navigation.go_add
0:57 Or go to add an element, we say, go_add like this.
1:02 Let's get rid of this space. There.
1:05 Like so. What do you think? Is it going to work?
1:07 Of course it's going to work because
1:08 our navigation is awesome. Alright.
1:12 Here it is.
1:13 Let's give it a click and see what happens.
1:14 Ready? Boom.
1:16 Just like that. We can add another measurement.
1:18 If we had deleted our elements out
1:20 maybe that's, maybe that's worth a little try here.
1:22 Let's go and do one more thing.
1:24 Let's go over to our data table.
1:25 Delete out the elements.
1:27 So I can go up here.
1:28 Right now, remember, I'm faking this out
1:30 to only...just only show no data.
1:33 So what I want to do is go through the experience
1:35 of there is no data, I click the button
1:38 I enter an element, then I have data.
1:41 So instead of deleting them
1:42 just so we still have them, I'm going to try
1:44 to simulate that by seeing...
1:46 Let's go for the 6th onward one.
1:49 Alright. Because there's five, and I said
1:51 Give me only the 6th and onward measurements
1:54 this thing thinks there's none.
1:56 So let's go and add one.
1:57 There should be at least one
1:58 and we'll get started from there.
1:59 So we'll say, add measurement
2:01 and I'll pick yesterday.
2:03 Let's say, The weight's 180, heart rate is 69.
2:08 I hit this. It'll take me back home.
2:10 Going back home should realize that
2:12 there's now at least one element
2:14 shows something different. Boom.
2:17 There it goes. Now, why do we see all of these here?
2:18 We see two, four, six because
2:21 remember, I was doing the slice up here; but
2:25 down the bottom we're getting all of them again.
2:27 That works. That's the flow that we're looking for.
2:30 You go there, you land on the page
2:31 you've signed up for an account
2:33 you don't have any measurements.
2:34 Put one in. Boom.
2:36 You're taken back. Now, that graph is shown.
2:38 I think this whole graph and home page thing is
2:41 well, it's pretty good.
2:42 I'm going to call it done.