mirror of
https://gitlab.silvrtree.co.uk/martind2000/mdot_server.git
synced 2025-02-04 10:50:13 +00:00
turned off rectangles
This commit is contained in:
parent
7226a31a8e
commit
157a7701ec
@ -1,5 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
/* global Backbone, _, $, AmCharts */
|
/* global Backbone, _, $, AmCharts, notification */
|
||||||
/* global mainview */
|
/* global mainview */
|
||||||
/* jshint browser: true , devel: true*/
|
/* jshint browser: true , devel: true*/
|
||||||
|
|
||||||
@ -38,23 +38,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
splitOccupancy: function(item) {
|
findOccupancy: function(ts) {
|
||||||
|
|
||||||
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) {
|
|
||||||
/*
|
/*
|
||||||
Get a branch from the date tree and see if the reduced set of records has a matching timestamp..
|
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 tsMS = tsDate.getTime();
|
||||||
let branch = this.dateTree[tsDate.getFullYear().toString()][tsDate.getMonth().toString()][tsDate.getDate().toString()];
|
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) {
|
_(branch).each(function(item) {
|
||||||
if ((tsMS >= item.startMS) && (tsMS <= item.endMS)) {
|
if ((tsMS >= item.startMS) && (tsMS <= item.endMS)) {
|
||||||
count = item.count;
|
count = item.count;
|
||||||
@ -120,7 +104,6 @@
|
|||||||
processAdded: function() {
|
processAdded: function() {
|
||||||
console.log('Model:ProcessAdded');
|
console.log('Model:ProcessAdded');
|
||||||
console.time('processAdd');
|
console.time('processAdd');
|
||||||
var self = this;
|
|
||||||
var skipOccupancy = false;
|
var skipOccupancy = false;
|
||||||
var tempCollection = new Backbone.Collection();
|
var tempCollection = new Backbone.Collection();
|
||||||
|
|
||||||
@ -137,7 +120,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
_(events.data).each(function(i) {
|
_(events.data).each(function(i) {
|
||||||
let _occupancy;
|
let _occupancy = 0;
|
||||||
|
|
||||||
if (!skipOccupancy) {
|
if (!skipOccupancy) {
|
||||||
_occupancy = this.findOccupancy(i.timestamp, events.occupancy);
|
_occupancy = this.findOccupancy(i.timestamp, events.occupancy);
|
||||||
@ -236,8 +219,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
}, render: function() {
|
}, render: function() {
|
||||||
var that = this;
|
|
||||||
|
|
||||||
console.log('MDOT:render');
|
console.log('MDOT:render');
|
||||||
$('#output').empty();
|
$('#output').empty();
|
||||||
|
|
||||||
@ -395,8 +376,8 @@
|
|||||||
],
|
],
|
||||||
graphs: [{id: 'occ',
|
graphs: [{id: 'occ',
|
||||||
valueAxis: 'occupancy',
|
valueAxis: 'occupancy',
|
||||||
type: 'column',
|
type: 'line',
|
||||||
clustered: true,
|
clustered: false,
|
||||||
columnWidth: 1,
|
columnWidth: 1,
|
||||||
lineColor: '#aaaaaa',
|
lineColor: '#aaaaaa',
|
||||||
title: 'Occupancy',
|
title: 'Occupancy',
|
||||||
@ -494,6 +475,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
console.timeEnd('chartData');
|
console.timeEnd('chartData');
|
||||||
|
console.log('Record count:',chartData.length);
|
||||||
|
|
||||||
// Console.log(chartData);
|
// Console.log(chartData);
|
||||||
self.doChartV2(chartData);
|
self.doChartV2(chartData);
|
||||||
|
Loading…
Reference in New Issue
Block a user