fix error for some records in acc chart
This commit is contained in:
parent
ec11f2541d
commit
6f6da95780
@ -1,5 +1,6 @@
|
||||
let allAccSerial = []
|
||||
let allSerialCoords = []
|
||||
let allTcpCoords = []
|
||||
|
||||
var ctx = document.getElementById('accChart').getContext('2d');
|
||||
var accChart = new Chart(ctx, {
|
||||
@ -48,10 +49,6 @@ var accChart = new Chart(ctx, {
|
||||
}
|
||||
});
|
||||
|
||||
function addSerialHAccData(){
|
||||
|
||||
}
|
||||
|
||||
function addDistances(tcpDataList, serialDataList){
|
||||
let tcpCoords = []
|
||||
let serialCoords = []
|
||||
@ -66,12 +63,13 @@ function addDistances(tcpDataList, serialDataList){
|
||||
})
|
||||
|
||||
tcpDataList.forEach(sensordata => {
|
||||
if (!(sensordata.Position[0] === 0) && !(sensordata.Position[1] === 0)) {
|
||||
let tcpCoord = [sensordata.Position[1], sensordata.Position[0]]
|
||||
tcpCoords.push(tcpCoord)
|
||||
|
||||
let time = sensordata.Servertime
|
||||
tcpTimes.push(time)
|
||||
if(!(sensordata.Speed === 0) && !(sensordata.HAcc === 0)){
|
||||
if (!(sensordata.Position[0] === 0) && !(sensordata.Position[1] === 0)) {
|
||||
let tcpCoord = [sensordata.Position[1], sensordata.Position[0]]
|
||||
tcpCoords.push(tcpCoord)
|
||||
let time = sensordata.Timestamp
|
||||
tcpTimes.push(time)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -56,6 +56,7 @@ function addSerialSpeedData() {
|
||||
})
|
||||
speedChart.data.datasets[0].data = speeds;
|
||||
speedChart.update();
|
||||
console.log("speeds serial " + speeds.length)
|
||||
}
|
||||
|
||||
function addTCPSpeedData(sensordataList) {
|
||||
@ -72,6 +73,8 @@ function addTCPSpeedData(sensordataList) {
|
||||
times.push(time)
|
||||
|
||||
})
|
||||
console.log("speeds tcp " + speedsTCP.length)
|
||||
|
||||
speedChart.data.labels = times;
|
||||
speedChart.data.datasets[1].data = speedsTCP;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
var trackingdata = null;
|
||||
let indexes
|
||||
|
||||
function composeServertime(servertime){
|
||||
function composeTimestamp(servertime){
|
||||
var composed;
|
||||
composed = servertime.slice(11,25).split(':').join("").split('.').join("");
|
||||
return composed;
|
||||
@ -37,18 +37,19 @@ function findSerialDataIndex(tcpdataList, serialdataList) {
|
||||
|
||||
serialdataList.forEach(sensordata => {
|
||||
if (!(sensordata.Speed === 0) && !(sensordata.HAcc === 0)) {
|
||||
let serialTimestamp;
|
||||
allSpeedsSerial.push(sensordata.Speed)
|
||||
allAccSerial.push(sensordata.HAcc)
|
||||
allSerialCoords.push([sensordata.Position[1], sensordata.Position[0]])
|
||||
serialTimestamp = composeServertime(sensordata.Servertime)
|
||||
if(!(sensordata.Position[1] === 0) && !(sensordata.Position[0] === 0)){
|
||||
allSerialCoords.push([sensordata.Position[1], sensordata.Position[0]])
|
||||
}
|
||||
let serialTimestamp = composeTimestamp(sensordata.Timestamp)
|
||||
allSerialTimes.push(serialTimestamp)
|
||||
}
|
||||
})
|
||||
|
||||
tcpdataList.forEach(sensordata => {
|
||||
if (!(sensordata.Speed === 0)) {
|
||||
let tcpTimestamp = composeServertime(sensordata.Servertime)
|
||||
if (!(sensordata.Speed === 0) && !(sensordata.HAcc === 0)) {
|
||||
let tcpTimestamp = composeTimestamp(sensordata.Timestamp)
|
||||
let index = findBestTimeMatch(tcpTimestamp, allSerialTimes)[1]
|
||||
|
||||
indexes.push(index)
|
||||
@ -107,7 +108,6 @@ window.addEventListener("load", function(evt) {
|
||||
if ('SOURCE_SERIAL' in r.data.Data && r.data.Data.SOURCE_SERIAL.length > 0) {
|
||||
updateMapSERIALbulk(r.data.Data.SOURCE_SERIAL)
|
||||
addSerialSpeedData()
|
||||
addSerialHAccData()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user