All that’s left is to display this data in our dashboard. We’ll call the get_user_signups function from client code and put the data into a plot just as we did in Chapter 3.

Go to Form1’s ‘Code’ view and add this build_signups_graph function:

def build_signups_graph(self):
    # Get the data from our external database, and store it as 'signups'
    signups ='get_user_signups')
    # Create a Scatter plot with this data, and change the colour of the line
    scatter = go.Scatter(x = [x['date'] for x in signups],
                         y = [x['signups'] for x in signups],
                         line=dict(color='#2196f3')) = scatter

We want to plot this data when our app runs, so let’s call it from the __init__ method of Form1:


Run your app

Click run and your dashboard should look something like this:

Screenshot of dashboard with two graphs