sort/filter by max average ratio
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
<mat-option value="AVERAGE">average</mat-option>
|
<mat-option value="AVERAGE">average</mat-option>
|
||||||
<mat-option value="VALUES">#values</mat-option>
|
<mat-option value="VALUES">#values</mat-option>
|
||||||
<mat-option value="PLOTTED_VALUES">#plotted values</mat-option>
|
<mat-option value="PLOTTED_VALUES">#plotted values</mat-option>
|
||||||
|
<mat-option value="MAX_AVG_RATIO">max avg ratio</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
@@ -17,10 +18,17 @@
|
|||||||
|
|
||||||
<mat-form-field *ngIf="filterBy == 'MAX_VALUE' || filterBy == 'AVERAGE'" class="pdb-form-mid">
|
<mat-form-field *ngIf="filterBy == 'MAX_VALUE' || filterBy == 'AVERAGE'" class="pdb-form-mid">
|
||||||
<mat-select [(value)]="unit">
|
<mat-select [(value)]="unit">
|
||||||
|
<mat-option value="NO_UNIT">-</mat-option>
|
||||||
<mat-option value="MILLISECONDS">millis</mat-option>
|
<mat-option value="MILLISECONDS">millis</mat-option>
|
||||||
<mat-option value="SECONDS">seconds</mat-option>
|
<mat-option value="SECONDS">seconds</mat-option>
|
||||||
<mat-option value="MINUTES">minutes</mat-option>
|
<mat-option value="MINUTES">minutes</mat-option>
|
||||||
<mat-option value="HOURS">hours</mat-option>
|
<mat-option value="HOURS">hours</mat-option>
|
||||||
<mat-option value="DAYS">days</mat-option>
|
<mat-option value="DAYS">days</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field *ngIf="filterBy == 'MAX_AVG_RATIO'" class="pdb-form-mid">
|
||||||
|
<mat-select value="NO_UNIT">
|
||||||
|
<mat-option value="NO_UNIT">percent</mat-option>
|
||||||
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="fieldStatsMaxValue">Max value: <span class="time">{{ utils.formatMs(data.stats.maxValue) }}</span></div>
|
<div class="fieldStatsMaxValue">Max value: <span class="time">{{ utils.formatMs(data.stats.maxValue) }}</span></div>
|
||||||
<div class="fieldStatsAverage">Average: <span class="time">{{ utils.formatMs(data.stats.average) }}</span></div>
|
<div class="fieldStatsAverage">Average: <span class="time">{{ utils.formatMs(data.stats.average) }}</span></div>
|
||||||
|
<div class="fieldStatsAverage">Max Avg. Ratio: <span class="time">{{ data.stats.maxAvgRatio }}</span></div>
|
||||||
</div>
|
</div>
|
||||||
<pdb-plot-details *ngIf="showDetails" [stats]="data.stats"></pdb-plot-details>
|
<pdb-plot-details *ngIf="showDetails" [stats]="data.stats"></pdb-plot-details>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
<mat-option value="AVERAGE">average</mat-option>
|
<mat-option value="AVERAGE">average</mat-option>
|
||||||
<mat-option value="VALUES">#values</mat-option>
|
<mat-option value="VALUES">#values</mat-option>
|
||||||
<mat-option value="PLOTTED_VALUES">#plotted values</mat-option>
|
<mat-option value="PLOTTED_VALUES">#plotted values</mat-option>
|
||||||
|
<mat-option value="MAX_AVG_RATIO">max avg ratio</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
|||||||
@@ -177,6 +177,9 @@ export class GalleryViewComponent implements OnInit {
|
|||||||
case "AVERAGE":
|
case "AVERAGE":
|
||||||
this.galleryItems.sort(function(a, b){return orderFactor*(a.stats.average - b.stats.average);});
|
this.galleryItems.sort(function(a, b){return orderFactor*(a.stats.average - b.stats.average);});
|
||||||
break;
|
break;
|
||||||
|
case 'MAX_AVG_RATIO':
|
||||||
|
this.galleryItems.sort((a,b) => orderFactor*(a.stats.maxAvgRatio - b.stats.maxAvgRatio));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +208,8 @@ export class GalleryViewComponent implements OnInit {
|
|||||||
return predicate(galleryItem.stats.values, this.filter.value);
|
return predicate(galleryItem.stats.values, this.filter.value);
|
||||||
case 'PLOTTED_VALUES':
|
case 'PLOTTED_VALUES':
|
||||||
return predicate(galleryItem.stats.plottedValues, this.filter.value);
|
return predicate(galleryItem.stats.plottedValues, this.filter.value);
|
||||||
|
case 'MAX_AVG_RATIO':
|
||||||
|
return predicate(galleryItem.stats.maxAvgRatio, this.filter.value/100.0);
|
||||||
}
|
}
|
||||||
throw "unhandled option: " + this.filter.filterBy;
|
throw "unhandled option: " + this.filter.filterBy;
|
||||||
}
|
}
|
||||||
@@ -212,6 +217,8 @@ export class GalleryViewComponent implements OnInit {
|
|||||||
timeUnitToMillis(value, unit)
|
timeUnitToMillis(value, unit)
|
||||||
{
|
{
|
||||||
switch(unit){
|
switch(unit){
|
||||||
|
case 'NO_UNIT':
|
||||||
|
return value;
|
||||||
case 'MILLISECONDS':
|
case 'MILLISECONDS':
|
||||||
return value;
|
return value;
|
||||||
case 'SECONDS':
|
case 'SECONDS':
|
||||||
|
|||||||
@@ -53,7 +53,22 @@ export class PlotService {
|
|||||||
sendPlotRequest(plotRequest: PlotRequest): Observable<PlotResponse>{
|
sendPlotRequest(plotRequest: PlotRequest): Observable<PlotResponse>{
|
||||||
|
|
||||||
//console.log("send plot request: "+ JSON.stringify(plotRequest));
|
//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>{
|
getFilterDefaults(): Observable<FilterDefaults>{
|
||||||
@@ -223,6 +238,7 @@ export class PlotResponseStats {
|
|||||||
values : number;
|
values : number;
|
||||||
average : number ;
|
average : number ;
|
||||||
plottedValues : number;
|
plottedValues : number;
|
||||||
|
maxAvgRatio: number;
|
||||||
dataSeriesStats : Array<DataSeriesStats>;
|
dataSeriesStats : Array<DataSeriesStats>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user