sort/filter by max average ratio
This commit is contained in:
@@ -53,7 +53,22 @@ export class PlotService {
|
||||
sendPlotRequest(plotRequest: PlotRequest): Observable<PlotResponse>{
|
||||
|
||||
//console.log("send plot request: "+ JSON.stringify(plotRequest));
|
||||
return this.http.post<PlotResponse>('//'+window.location.hostname+':'+window.location.port+'/api/plots', plotRequest);
|
||||
const result = this.http.post<PlotResponse>('//'+window.location.hostname+':'+window.location.port+'/api/plots', plotRequest);
|
||||
return result.pipe(map(this.enrichStats));
|
||||
}
|
||||
|
||||
enrichStats(response: PlotResponse): PlotResponse {
|
||||
let maxAvgRatio = 0;
|
||||
let x : DataSeriesStats[] = response.stats.dataSeriesStats;
|
||||
for (const row in x){
|
||||
for (const col in x){
|
||||
maxAvgRatio = Math.max(maxAvgRatio, x[row].average / x[col].average);
|
||||
}
|
||||
}
|
||||
|
||||
response.stats.maxAvgRatio = maxAvgRatio;
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
getFilterDefaults(): Observable<FilterDefaults>{
|
||||
@@ -223,6 +238,7 @@ export class PlotResponseStats {
|
||||
values : number;
|
||||
average : number ;
|
||||
plottedValues : number;
|
||||
maxAvgRatio: number;
|
||||
dataSeriesStats : Array<DataSeriesStats>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user