       if gquery = window.gqueries.with_key(key)
         gquery.handle_api_result(values)
 
-    window.charts.invoke 'trigger', 'refresh'
+    @charts.invoke 'trigger', 'refresh'
     if t = window.targets
       t.invoke('update_view')
       t.update_totals()


  # At this point we have all the settings initialized.
  bootstrap: =>
    dashChangeEl = $('#dashboard_change')

    @sidebar.bootstrap()
    # If a "change dashboard" button is present, set up the DashboardChanger.

    @router.load_default_slides()

    if dashChangeEl.length > 0
      new DashboardChangerView(dashChangeEl)


class @AppView extends Backbone.View
  initialize: ->
    @settings    = new Setting({api_session_id: globals.api_session_id})
    @sidebar     = new SidebarView()
    @scenario    = new Scenario()
    @router      = new Router()
    @merit_order = new MeritOrder(this)
    Backbone.history.start()

