-
Notifications
You must be signed in to change notification settings - Fork 1
/
logviewer.data.msdroid.js
57 lines (44 loc) · 1.25 KB
/
logviewer.data.msdroid.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
function processMSDroidLog(series,data) {
const minValues = {}
const maxValues = {}
let CaptureDateLine = data[1].substr(15, 28)
CaptureDateLine=CaptureDateLine.replace("BST","GMT-1");
const startDate = new Date(CaptureDateLine)
while (data[0].indexOf('\t') === -1) {
data.splice(0, 1);
}
const headers = data[0].split('\t')
for (let i = 0; i < headers.length; i++) {
headers[i]=headers[i].trim()
series[headers[i]]=[];
}
for (let i = 1; i < data.length; i++) {
const values = data[i].split('\t')
if(values.length <headers.length) {
console.log(data[i]);
continue
}
if (isNaN(Number(values[0]))) {
continue;
}
for (let j = 0; j < values.length; j++) {
const seriesName = headers[j]
let dataPoint = Number(values[j]);
if(seriesName==="Time") {
var components=values[j].split('.')
//dataPoint=getDate(values[j])
dataPoint=new Date(startDate)
dataPoint.setSeconds(components[0]);
dataPoint.setMilliseconds(components[1]);
}
manageMaxMin(dataPoint,seriesName,maxValues,minValues)
series[seriesName].push(dataPoint)
}
}
series.XAxis="Time"
series.defaultSelections = ["RPM", "CLT", "IAT"]
series.headers=headers
series.maxValues=maxValues
series.minValues=minValues
return series
}