diff --git a/app/js/mdot.js b/app/js/mdot.js index 2c6c019..254b0e4 100644 --- a/app/js/mdot.js +++ b/app/js/mdot.js @@ -1,5 +1,5 @@ 'use strict'; -/* global Backbone, _, $, AmCharts */ +/* global Backbone, _, $, AmCharts, notification */ /* global mainview */ /* jshint browser: true , devel: true*/ @@ -38,23 +38,7 @@ }); }, - splitOccupancy: function(item) { - - var start = new Date(item.start); - var msStart = ~~(start.getTime() / 300000); - - var end = new Date(item.end); - var msEnd = ~~(end.getTime() / 300000); - - var newArray = []; - - for (var t = 0; t < (msEnd - msStart);t++) { - newArray.push({date: new Date((msStart * (300000)) + (t * 300000)), count: item.count}); - } - return newArray; - - }, - findOccupancy: function(ts, occupancy) { + findOccupancy: function(ts) { /* Get a branch from the date tree and see if the reduced set of records has a matching timestamp.. */ @@ -63,7 +47,7 @@ let tsMS = tsDate.getTime(); let branch = this.dateTree[tsDate.getFullYear().toString()][tsDate.getMonth().toString()][tsDate.getDate().toString()]; - if (typeof branch === 'undefined') return count; + if (typeof branch === 'undefined') {return count;} _(branch).each(function(item) { if ((tsMS >= item.startMS) && (tsMS <= item.endMS)) { count = item.count; @@ -120,7 +104,6 @@ processAdded: function() { console.log('Model:ProcessAdded'); console.time('processAdd'); - var self = this; var skipOccupancy = false; var tempCollection = new Backbone.Collection(); @@ -137,7 +120,7 @@ } _(events.data).each(function(i) { - let _occupancy; + let _occupancy = 0; if (!skipOccupancy) { _occupancy = this.findOccupancy(i.timestamp, events.occupancy); @@ -236,8 +219,6 @@ }); }, render: function() { - var that = this; - console.log('MDOT:render'); $('#output').empty(); @@ -395,8 +376,8 @@ ], graphs: [{id: 'occ', valueAxis: 'occupancy', - type: 'column', - clustered: true, + type: 'line', + clustered: false, columnWidth: 1, lineColor: '#aaaaaa', title: 'Occupancy', @@ -494,6 +475,7 @@ }); }); console.timeEnd('chartData'); + console.log('Record count:',chartData.length); // Console.log(chartData); self.doChartV2(chartData);