We want to call our get_revenue server function when the app is opened. We made our get_revenue server function available to our client-side code by decorating it as @anvil.server.callable.

This means we can call it from our client-side code using anvil.server.call('get_revenue')

Go back to Form1 and change your build_revenue_graph function to look like this:

def build_revenue_graph(self):
  # Get the data from our server function, and store it as 'db_data'
  db_data = anvil.server.call('get_revenue')

  # Create a Bar plot with this data, and change the colour of the markers
  self.plot_1.data = go.Bar(
    x = [x['date'] for x in db_data],
    y = [x['amount'] for x in db_data],
    marker=dict(color='#2196f3')
  )