The dashboard view controller

There isn't any interactivity on the dashboard, so there's not much for the view controller to do. We'll use it to control the live refresh aspect of the charts:

// app/view/dashboard/DashboardController.js
Ext.define('Instrumatics.view.dashboard.DashboardController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.dashboard-dashboard',
    
    init: function() {
        var data = this.getViewModel().getData(),
            me = this;

        setInterval(function() {
            data.webLogs.load({ addRecords: true });
            data.sqlLogs.load({ addRecords: true });
        }, 1000);
    }
});

It's as simple as this; every second, grab the store powering the live chart and call its load method with the addRecords option set to true. This will cause new records to be appended ...

Get Ext JS Application Development Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.