disable plot types instead of hiding them

This commit is contained in:
2019-12-27 19:36:08 +01:00
parent 90244c6e4b
commit 1587046907
4 changed files with 10 additions and 9 deletions

View File

@@ -20,9 +20,7 @@ export class VisualizationPageComponent implements OnInit {
readonly DATE_PATTERN = "YYYY-MM-DD HH:mm:ss"; // for moment-JS
dateRange = new FormControl('2019-10-05 00:00:00 - 2019-10-11 23:59:59');
availablePlotTypes = [];
selectedPlotType = [];
plotTypes: Array<any>;
@@ -64,9 +62,7 @@ export class VisualizationPageComponent implements OnInit {
const that = this;
this.plotTypes = this.plotService.getPlotTypes();
this.selectedPlotType.push(this.plotTypes[0]);
this.availablePlotTypes = [].concat(this.plotTypes);
that.plotService.getFilterDefaults().subscribe(function(filterDefaults) {
filterDefaults.fields.forEach(function(name) {
@@ -83,8 +79,9 @@ export class VisualizationPageComponent implements OnInit {
}
changePlotType(selectedPlotTypes: Array<PlotType>) {
const compatiblePlotTypes = this.availablePlotTypes.filter(pt => pt.compatible(selectedPlotTypes));
this.plotTypes = compatiblePlotTypes;
const compatiblePlotTypes = this.plotTypes.filter(pt => pt.compatible(selectedPlotTypes));
this.plotTypes.forEach(pt => pt.active=false);
compatiblePlotTypes.forEach(pt => pt.active=true);
}