|
@@ -22,6 +22,8 @@ export class SensorComponent implements OnInit, OnDestroy, AfterViewInit {
|
|
|
unitId: number;
|
|
unitId: number;
|
|
|
data = [];
|
|
data = [];
|
|
|
time = [];
|
|
time = [];
|
|
|
|
|
+ yFrom : number;
|
|
|
|
|
+ yTo : number;
|
|
|
from: Date = moment().hour(0).minutes(0).subtract(7, 'days').toDate();
|
|
from: Date = moment().hour(0).minutes(0).subtract(7, 'days').toDate();
|
|
|
to: Date = moment().toDate();
|
|
to: Date = moment().toDate();
|
|
|
sensor: Sensor;
|
|
sensor: Sensor;
|
|
@@ -163,17 +165,16 @@ export class SensorComponent implements OnInit, OnDestroy, AfterViewInit {
|
|
|
const box = this.viewElement.nativeElement;
|
|
const box = this.viewElement.nativeElement;
|
|
|
if (this.graphView) {
|
|
if (this.graphView) {
|
|
|
const newWidth = box.getBoundingClientRect().width - 50;
|
|
const newWidth = box.getBoundingClientRect().width - 50;
|
|
|
- this.graphView.width(newWidth).height(300).run();
|
|
|
|
|
- console.log('Requested width : ', newWidth);
|
|
|
|
|
- console.log('Got width: ', this.graphView.width());
|
|
|
|
|
-
|
|
|
|
|
- // check if Vega "stole" pixels. If it did, force it again.
|
|
|
|
|
- /*
|
|
|
|
|
- if (this.graphView.width() < newWidth - 50) {
|
|
|
|
|
- this.graphView.width(newWidth).height(300).runAsync();
|
|
|
|
|
- console.log('Calling resize twice');
|
|
|
|
|
- }
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ GraphLoader.ResizeGraph(this.graphView, newWidth);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ changeGraphY() {
|
|
|
|
|
+ console.log(this.yFrom + ' ' + this.yTo);
|
|
|
|
|
+ // check if the values are valid - To is larger than From and they are not equal
|
|
|
|
|
+ if (this.yTo < this.yFrom || this.yTo === this.yFrom) {
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
|
|
+ GraphLoader.ChangeYRange(this.graphView, this.yFrom, this.yTo);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|