pages/windApp/windApp.js
function getOverallBarChart(){
    var contextMenuActions = [{
        name: 'Explore windmill', 
        action: function(ae, splitBy, timestamp) {
            explore(splitBy);
        }        
    }]    
    var endDate = new Date(Math.floor((new Date()).valueOf()/(1000*60*60*24))*(1000*60*60*24));
    var startDate = new Date(endDate.valueOf() - 1000*60*60*24*7);
    var aggregateExpressions = [];
    aggregateExpressions.push(new tsiClient.ux.AggregateExpression({predicateString: "DSCR HAS 'Grid Power'"}, {property: 'VALUE', type: "Double"}, ['sum'],
        { from: startDate, to: endDate, bucketSize: '1d' }, {property: 'UNIT', type: 'String'}, 'teal', 'GridPower', contextMenuActions));
    authContext.getTsiToken().then(function(token){
        tsiClient.server.getAggregates(token, environmentFqdn, aggregateExpressions.map(function(ae){return ae.toTsx()})).then(function(result){
            var barChart = new tsiClient.ux.BarChart(document.getElementById('chart0'));
            var transformedResult = tsiClient.ux.transformAggregatesForVisualization(result, aggregateExpressions);
            barChart.render(transformedResult, {legend: 'hidden', zeroYAxis: true, keepSplitByColor: true, tooltip: true}, aggregateExpressions);
        });    
    });
}
function getOverallBarChart(){
    var contextMenuActions = [{
        name: 'Explore windmill', 
        action: function(ae, splitBy, timestamp) {
            explore(splitBy);
        }        
    }]    
    var endDate = new Date(Math.floor((new Date()).valueOf()/(1000*60*60*24))*(1000*60*60*24));
    var startDate = new Date(endDate.valueOf() - 1000*60*60*24*7);
    var aggregateExpressions = [];
    aggregateExpressions.push(new tsiClient.ux.AggregateExpression({predicateString: "DSCR HAS 'Grid Power'"}, {property: 'VALUE', type: "Double"}, ['sum'],
        { from: startDate, to: endDate, bucketSize: '1d' }, {property: 'UNIT', type: 'String'}, 'teal', 'GridPower', contextMenuActions));
    authContext.getTsiToken().then(function(token){
        tsiClient.server.getAggregates(token, environmentFqdn, aggregateExpressions.map(function(ae){return ae.toTsx()})).then(function(result){
            var barChart = new tsiClient.ux.BarChart(document.getElementById('chart0'));
            var transformedResult = tsiClient.ux.transformAggregatesForVisualization(result, aggregateExpressions);
            barChart.render(transformedResult, {legend: 'hidden', zeroYAxis: true, keepSplitByColor: true, tooltip: true}, aggregateExpressions);
        });    
    });
}
function getOverallBarChart ( ) { var contextMenuActions = [ { name : 'Explore windmill' , action : function ( ae , splitBy , timestamp ) { explore ( splitBy ) ; } } ] var endDate = new Date ( Math . floor ( ( new Date ( ) ) . valueOf ( ) / ( 1000 * 60 * 60 * 24 ) ) * ( 1000 * 60 * 60 * 24 ) ) ; var startDate = new Date ( endDate . valueOf ( ) - 1000 * 60 * 60 * 24 * 7 ) ; var aggregateExpressions = [ ] ; aggregateExpressions . push ( new tsiClient . ux . AggregateExpression ( { predicateString : "DSCR HAS 'Grid Power'" } , { property : 'VALUE' , type : "Double" } , [ 'sum' ] , { from : startDate , to : endDate , bucketSize : '1d' } , { property : 'UNIT' , type : 'String' } , 'teal' , 'GridPower' , contextMenuActions ) ) ; authContext . getTsiToken ( ) . then ( function ( token ) { tsiClient . server . getAggregates ( token , environmentFqdn , aggregateExpressions . map ( function ( ae ) { return ae . toTsx ( ) } ) ) . then ( function ( result ) { var barChart = new tsiClient . ux . BarChart ( document . getElementById ( 'chart0' ) ) ; var transformedResult = tsiClient . ux . transformAggregatesForVisualization ( result , aggregateExpressions ) ; barChart . render ( transformedResult , { legend : 'hidden' , zeroYAxis : true , keepSplitByColor : true , tooltip : true } , aggregateExpressions ) ; } ) ; } ) ; }
Bar chart for overall production
Bar chart for overall production