use one multi-select drop down for plot type

All plot types we currently have can be combined
in one image. So there is no need to compute
combinable types.
This commit is contained in:
2019-11-24 10:53:30 +01:00
parent 06b379494f
commit 20b710547f
2 changed files with 6 additions and 34 deletions

View File

@@ -23,12 +23,9 @@ export class VisualizationPageComponent implements OnInit {
availablePlotTypes = {};
selectedPlotType = new FormControl('');
selectedPlotType = [];
plotTypes: Array<any>;
selectedCombinePlotType = new FormControl('');
combinePlotTypes: Array<any>;
tagFields: Array<TagField> = new Array<TagField>();
groupBy = new Array<TagField>();
@@ -66,12 +63,10 @@ export class VisualizationPageComponent implements OnInit {
ngOnInit() {
const that = this;
this.plotTypes = this.plotService.getPlotTypes();
this.selectedPlotType.setValue(this.plotTypes[0]);
this.selectedPlotType.push(this.plotTypes[0]);
this.plotTypes.forEach(pt => this.availablePlotTypes[pt.name] = pt);
this.combinePlotTypes = this.getCombinablePlotTypes(this.selectedPlotType.value);
that.plotService.getFilterDefaults().subscribe(function(filterDefaults) {
filterDefaults.fields.forEach(function(name) {
@@ -85,16 +80,6 @@ export class VisualizationPageComponent implements OnInit {
that.splitBy = that.tagFields.find(val => filterDefaults.splitBy == val.name);
});
this.yAxisScale = "LOG10";
this.selectedPlotType.valueChanges.subscribe(function(selectedMainPlotType){
that.combinePlotTypes = that.getCombinablePlotTypes(selectedMainPlotType);
if (!that.combinePlotTypes.includes(that.selectedCombinePlotType.value)){
that.selectedCombinePlotType.setValue('');
}
},
error => {
that.showError(error.error.message);
});
}
getCombinablePlotTypes(selectedMainPlotType) : Array<any>{
@@ -137,10 +122,7 @@ export class VisualizationPageComponent implements OnInit {
createPlotRequest(): PlotRequest {
const aggregates = [];
aggregates.push(this.selectedPlotType.value.id);
if (this.selectedCombinePlotType.value){
aggregates.push(this.selectedCombinePlotType.value.id);
}
this.selectedPlotType.forEach(a => aggregates.push(a.id));
const request = new PlotRequest();
request.query = this.query.query;