All that’s left is to display this data in our dashboard. We’ll call the get_marketing_data 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 function:

def build_marketing_graph(self):
  # We’re calling a function on your local machine from the web!
  # Get the data and store it as 'marketing_data'
  marketing_data ='get_marketing_data')
  # Create a Line plot with this data, and change the colour of the line = go.Line(x = [x['strategy'] for x in marketing_data],
                             y = [x['count'] for x in marketing_data],

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 you’ll see we’ve populated three of our four graphs. Excellent work!

The data dashboard with three plots showing data, one still to be populated.