put y axis definition into its own object

This commit is contained in:
2020-02-08 15:39:41 +01:00
parent 6109227508
commit ed7cc9bee5
10 changed files with 96 additions and 72 deletions

View File

@@ -193,13 +193,11 @@ export class PlotRequest {
thumbnailMaxHeight : number = 200;
groupBy : Array<string>;
limitBy : string;
axisScale : string;
limit : number;
y1:YAxisDefinition;
y2:YAxisDefinition;
dateRange : string;
aggregates : Array<string>;
yRangeMin : number;
yRangeMax : number;
yRangeUnit : string;
keyOutside : boolean = false;
generateThumbnail : boolean;
@@ -208,6 +206,13 @@ export class PlotRequest {
}
}
export class YAxisDefinition {
axisScale : string;
yRangeMin : number;
yRangeMax : number;
yRangeUnit : string;
}
export class PlotResponse {
imageUrl : string;
stats : PlotResponseStats;

View File

@@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { PlotService, PlotType, PlotRequest, PlotResponse, TagField, FilterDefaults, DataType, AxesTypes } from '../plot.service';
import { PlotService, PlotType, PlotRequest, PlotResponse, TagField, FilterDefaults, DataType, YAxisDefinition, AxesTypes } from '../plot.service';
import { Observable } from 'rxjs/Observable';
import { FormControl, Validators } from '@angular/forms';
import { MatSnackBar } from '@angular/material/snack-bar';
@@ -139,6 +139,12 @@ export class VisualizationPageComponent implements OnInit {
const aggregates = [];
this.selectedPlotType.forEach(a => aggregates.push(a.id));
const y1 = new YAxisDefinition();
y1.axisScale = this.yAxisDefinitionComponent.yAxisScale;
y1.yRangeMin = this.yAxisDefinitionComponent.minYValue;
y1.yRangeMax = this.yAxisDefinitionComponent.maxYValue;
y1.yRangeUnit = this.yAxisDefinitionComponent.yAxisUnit;
const request = new PlotRequest();
request.query = this.query.query;
request.height = document.getElementById("results").offsetHeight-1;
@@ -146,14 +152,11 @@ export class VisualizationPageComponent implements OnInit {
request.groupBy = this.groupBy.map(o => o.name);
request.limitBy = this.limitbycomponent.limitBy;
request.limit = this.limitbycomponent.limit;
request.y1 = y1;
request.dateRange = this.dateRangeAsString();
request.aggregates = aggregates;
request.keyOutside = false;
request.generateThumbnail = this.enableGallery;
request.axisScale = this.yAxisDefinitionComponent.yAxisScale;
request.yRangeMin = this.yAxisDefinitionComponent.minYValue;
request.yRangeMax = this.yAxisDefinitionComponent.maxYValue;
request.yRangeUnit = this.yAxisDefinitionComponent.yAxisUnit;
return request;
}