diff --git a/pdb-js/src/app/gallery-view/gallery-filter-view.component.html b/pdb-js/src/app/gallery-view/gallery-filter-view.component.html index 098f522..e562029 100644 --- a/pdb-js/src/app/gallery-view/gallery-filter-view.component.html +++ b/pdb-js/src/app/gallery-view/gallery-filter-view.component.html @@ -6,6 +6,7 @@ average #values #plotted values + max avg ratio @@ -17,10 +18,17 @@ + - millis seconds minutes hours days + + + + + percent + \ No newline at end of file diff --git a/pdb-js/src/app/gallery-view/gallery-item-view.component.html b/pdb-js/src/app/gallery-view/gallery-item-view.component.html index 358a643..f7a4896 100644 --- a/pdb-js/src/app/gallery-view/gallery-item-view.component.html +++ b/pdb-js/src/app/gallery-view/gallery-item-view.component.html @@ -10,6 +10,7 @@
Max value: {{ utils.formatMs(data.stats.maxValue) }}
Average: {{ utils.formatMs(data.stats.average) }}
+
Max Avg. Ratio: {{ data.stats.maxAvgRatio }}
average #values #plotted values + max avg ratio diff --git a/pdb-js/src/app/gallery-view/gallery-view.component.ts b/pdb-js/src/app/gallery-view/gallery-view.component.ts index 420c4e3..913a4e7 100644 --- a/pdb-js/src/app/gallery-view/gallery-view.component.ts +++ b/pdb-js/src/app/gallery-view/gallery-view.component.ts @@ -177,6 +177,9 @@ export class GalleryViewComponent implements OnInit { case "AVERAGE": this.galleryItems.sort(function(a, b){return orderFactor*(a.stats.average - b.stats.average);}); 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); case 'PLOTTED_VALUES': 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; } @@ -212,6 +217,8 @@ export class GalleryViewComponent implements OnInit { timeUnitToMillis(value, unit) { switch(unit){ + case 'NO_UNIT': + return value; case 'MILLISECONDS': return value; case 'SECONDS': diff --git a/pdb-js/src/app/plot.service.ts b/pdb-js/src/app/plot.service.ts index c85c15c..4d27932 100644 --- a/pdb-js/src/app/plot.service.ts +++ b/pdb-js/src/app/plot.service.ts @@ -53,7 +53,22 @@ export class PlotService { sendPlotRequest(plotRequest: PlotRequest): Observable{ //console.log("send plot request: "+ JSON.stringify(plotRequest)); - return this.http.post('//'+window.location.hostname+':'+window.location.port+'/api/plots', plotRequest); + const result = this.http.post('//'+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{ @@ -223,6 +238,7 @@ export class PlotResponseStats { values : number; average : number ; plottedValues : number; + maxAvgRatio: number; dataSeriesStats : Array; }