@@ -33,10 +33,15 class PcolorBuffer { | |||||
33 | /* This function is used to plot all the data that have the DB and just is used when is loaded or reloaded*/ |
|
33 | /* This function is used to plot all the data that have the DB and just is used when is loaded or reloaded*/ | |
34 | setup(data) { |
|
34 | setup(data) { | |
35 | this.last = data.time.slice(-1); |
|
35 | this.last = data.time.slice(-1); | |
|
36 | var diffArr = []; | |||
|
37 | for(var i=0; i<data.time.length-1; i++){ | |||
|
38 | diffArr.push(data.time[i+1]-data.time[i]); | |||
|
39 | } | |||
|
40 | this.interval = Math.round(Math.min.apply(null, diffArr)*100 / 100); | |||
36 | if (data.time.length == 1) { |
|
41 | if (data.time.length == 1) { | |
37 | var values = { 'time': data.time, 'data': data['data'].map(function (x) { return [x] }) }; |
|
42 | var values = { 'time': data.time, 'data': data['data'].map(function (x) { return [x] }) }; | |
38 | } else { |
|
43 | } else { | |
39 |
var values = this.fill_gaps(data.time, data['data'], |
|
44 | var values = this.fill_gaps(data.time, data['data'], this.interval, data['data'].length); | |
40 | } |
|
45 | } | |
41 | var t = values.time.map(function (x) { |
|
46 | var t = values.time.map(function (x) { | |
42 | var a = new Date(x * 1000); |
|
47 | var a = new Date(x * 1000); | |
@@ -185,9 +190,9 class PcolorBuffer { | |||||
185 | // fill data gaps |
|
190 | // fill data gaps | |
186 | var cnt = 0; |
|
191 | var cnt = 0; | |
187 |
|
192 | |||
188 |
while (Math.abs(parseFloat(obj.time[0]) - this.last) > 1.5 * parseFloat( |
|
193 | while (Math.abs(parseFloat(obj.time[0]) - this.last) > 1.5 * parseFloat(this.interval)) { | |
189 | cnt += 1; |
|
194 | cnt += 1; | |
190 |
this.last += |
|
195 | this.last += this.interval; | |
191 | var newt = new Date((this.last) * 1000); |
|
196 | var newt = new Date((this.last) * 1000); | |
192 | // This condition is used to change from UTC to LT |
|
197 | // This condition is used to change from UTC to LT | |
193 | if (obj.metadata.localtime == true){ |
|
198 | if (obj.metadata.localtime == true){ | |
@@ -421,13 +426,18 class ScatterBuffer { | |||||
421 | /* This function is used to plot all the data that have the DB and just is used when is loaded or reloaded*/ |
|
426 | /* This function is used to plot all the data that have the DB and just is used when is loaded or reloaded*/ | |
422 | setup(data) { |
|
427 | setup(data) { | |
423 |
|
428 | |||
424 | //this.data = data; |
|
|||
425 |
|
|
429 | var traces = []; | |
426 | this.last = data.time.slice(-1); |
|
430 | this.last = data.time.slice(-1); | |
|
431 | var diffArr = []; | |||
|
432 | for(var i=0; i<data.time.length-1; i++){ | |||
|
433 | diffArr.push(data.time[i+1]-data.time[i]); | |||
|
434 | } | |||
|
435 | this.interval = Math.round(Math.min.apply(null, diffArr)*100 / 100); | |||
|
436 | ||||
427 | if (data.time.length == 1) { |
|
437 | if (data.time.length == 1) { | |
428 | var values = { 'time': data.time, 'data': data['data'] }; |
|
438 | var values = { 'time': data.time, 'data': data['data'] }; | |
429 | } else { |
|
439 | } else { | |
430 |
var values = this.fill_gaps(data.time, data['data'], |
|
440 | var values = this.fill_gaps(data.time, data['data'], this.interval, data['data'].length); | |
431 | } |
|
441 | } | |
432 |
|
442 | |||
433 | var t = values.time.map(function (x) { |
|
443 | var t = values.time.map(function (x) { | |
@@ -577,9 +587,9 class ScatterBuffer { | |||||
577 | update(obj) { |
|
587 | update(obj) { | |
578 | // fill data gaps |
|
588 | // fill data gaps | |
579 | var cnt = 0; |
|
589 | var cnt = 0; | |
580 |
while (Math.abs(parseFloat(obj.time[0]) - this.last ) > 1.5 * parseFloat( |
|
590 | while (Math.abs(parseFloat(obj.time[0]) - this.last ) > 1.5 * parseFloat(this.interval)) { | |
581 | cnt += 1; |
|
591 | cnt += 1; | |
582 |
this.last += |
|
592 | this.last += this.interval; | |
583 | var newt = new Date((this.last) * 1000); |
|
593 | var newt = new Date((this.last) * 1000); | |
584 | // This condition is used to change from UTC to LT |
|
594 | // This condition is used to change from UTC to LT | |
585 | if (obj.metadata.localtime == true){ |
|
595 | if (obj.metadata.localtime == true){ |
General Comments 0
You need to be logged in to leave comments.
Login now