diff --git a/src/app/visualize-all/visualize-all.component.html b/src/app/visualize-all/visualize-all.component.html
index ca3f8d8..27680a2 100644
--- a/src/app/visualize-all/visualize-all.component.html
+++ b/src/app/visualize-all/visualize-all.component.html
@@ -17,7 +17,7 @@
Ctrl/Comm+Click to select multiple generators
Please select a maximum of 5 generators
diff --git a/src/app/visualize-all/visualize-all.component.ts b/src/app/visualize-all/visualize-all.component.ts
index b4f7836..49307ee 100644
--- a/src/app/visualize-all/visualize-all.component.ts
+++ b/src/app/visualize-all/visualize-all.component.ts
@@ -8,8 +8,8 @@ import 'rxjs/add/operator/map';
import { $ } from 'protractor';
import * as moment from 'moment';
import { MatDatepickerModule, MatDatepicker } from '@angular/material/datepicker';
-import {GeneratorObject} from '../generator-object';
-import {LoginService} from '../services/login.service';
+import { GeneratorObject } from '../generator-object';
+import { LoginService } from '../services/login.service';
@Component({
selector: 'app-visualize-all',
@@ -52,10 +52,8 @@ export class VisualizeAllComponent implements OnInit {
const genValArray = [];
let genCount;
if (this.count === 0) {
- for (const key in this.generators$) {
- if (this.generators$.hasOwnProperty(key)) {
- genVals.push(this.generators$[key].gen_id + ',' + this.generators$[key].gen_name);
- }
+ if (this.generators$) {
+ genVals.push(this.generators$[0].gen_id + ',' + this.generators$[0].gen_name);
}
} else {
genVals = Array.prototype.slice.call(document.querySelectorAll('#gen_select option:checked'), 0).map(function (v, i, a) {
@@ -65,7 +63,11 @@ export class VisualizeAllComponent implements OnInit {
genCount = genVals.length;
this.signal = false;
- if (genVals[0] !== '') {
+ if (genCount === 0 ) {
+ genVal = 'generator';
+ this.signal = true;
+ errorMessage.push(genVal);
+ } else if (genVals[0] !== '') {
for (let i = 0; i < genVals.length; i++) {
const array = genVals[i].split(',');
const n = 0;
@@ -112,14 +114,16 @@ export class VisualizeAllComponent implements OnInit {
return v.value;
});
if (dataVals[0] !== '') {
- this.laymanDataVal$ = dataVal = dataVals[0] + '';
- dataVal = this.data.convertNames(dataVal, 'metric');
+ dataVal = this.data.convertNames(dataVals[0], 'metric');
} else {
dataVal = 'metric';
errorMessage.push(dataVal);
this.signal = true;
}
}
+ if (dataVal !== null) {
+ this.laymanDataVal$ = this.data.convertNames(dataVal, 'layman');
+ }
if (this.count === 0) {
@@ -205,6 +209,7 @@ export class VisualizeAllComponent implements OnInit {
if (this.signal === false) {
const labels = [];
const data = [];
+ console.log(timeStart, timeEnd, funcVal, genVal, dataVal, rangeVal);
try {
this.graphData.getDataForVis(this.jsonToken$, timeStart, timeEnd, funcVal, genVal, dataVal, rangeVal)
.subscribe((graphData) => {
diff --git a/src/app/visualize-one/visualize-one.component.ts b/src/app/visualize-one/visualize-one.component.ts
index e508713..42c3d8d 100644
--- a/src/app/visualize-one/visualize-one.component.ts
+++ b/src/app/visualize-one/visualize-one.component.ts
@@ -74,7 +74,11 @@ export class VisualizeOneComponent implements OnInit {
const dataType = localStorage.getItem('data_type');
let dataVal;
if (this.count === 0) {
- dataVal = 'intake.pressure';
+ if (dataType === null) {
+ dataVal = 'intake.pressure';
+ } else {
+ dataVal = dataType;
+ }
} else if (dataType === null) {
const dataVals = Array.prototype.slice.call(document.querySelectorAll('#data_select option:checked'), 0).map(function (v, i, a) {
return v.value;
@@ -94,6 +98,10 @@ export class VisualizeOneComponent implements OnInit {
} else {
dataVal = dataType;
}
+ if (dataVal !== null) {
+ this.laymanDataVal$ = this.data.convertNames(dataVal, 'layman');
+ this.dataType$ = this.laymanDataVal$;
+ }
let startTime = '';
let endTime = '';
@@ -227,8 +235,8 @@ export class VisualizeOneComponent implements OnInit {
}
async ngOnInit() {
- this.today$ = new Date().toISOString().split('T')[0];
- this.count = 0;
+ const today = new Date().toISOString().split('T')[0];
+ this.today$ = today;
this.dataNames$ = this.data.getAllNames('layman');
this.jsonToken$ = await this.login.getToken();
const dataType = localStorage.getItem('data_type');