Fixed hit distribution
This commit is contained in:
parent
36376b9f00
commit
da232f737e
@ -79,7 +79,10 @@ export class ChartHitDistributionComponent implements OnInit, OnChanges {
|
|||||||
const upperBound = percentiles[1] + 1.5 * iqr;
|
const upperBound = percentiles[1] + 1.5 * iqr;
|
||||||
|
|
||||||
// Filter outliers
|
// Filter outliers
|
||||||
ys = ys.filter(y => y > lowerBound && y < upperBound);
|
let removedOutliers = ys.filter(y => y > lowerBound && y < upperBound);
|
||||||
|
if(removedOutliers.length > 0) {
|
||||||
|
ys = removedOutliers;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assuming data is already without outliers and sorted if necessary
|
// Assuming data is already without outliers and sorted if necessary
|
||||||
@ -259,8 +262,7 @@ export class ChartHitDistributionComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let key = range[0]; key <= range[1]; key += 2) {
|
for (let key = range[0]; key <= range[1]; key += 2) {
|
||||||
const endKey = key + 2 <= range[1] ? key + 2 : key + 1;
|
labels.push(`${key}ms to ${key + 2}ms`);
|
||||||
labels.push(`${key}ms to ${endKey}ms`);
|
|
||||||
|
|
||||||
const currentEntry = entriesMap.get(key) || { ...defaultValues };
|
const currentEntry = entriesMap.get(key) || { ...defaultValues };
|
||||||
const nextEntry = key + 1 <= range[1] ? (entriesMap.get(key + 1) || { ...defaultValues }) : defaultValues;
|
const nextEntry = key + 1 <= range[1] ? (entriesMap.get(key + 1) || { ...defaultValues }) : defaultValues;
|
||||||
@ -279,14 +281,15 @@ export class ChartHitDistributionComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handling the case for an odd last key if needed
|
// Handling the case for an odd last key if needed
|
||||||
if (range[1] % 2 !== range[0] % 2) {
|
// if (range[1] % 2 !== range[0] % 2) {
|
||||||
const lastEntry = entriesMap.get(range[1]) || { ...defaultValues };
|
// const lastEntry = entriesMap.get(range[1]) || { ...defaultValues };
|
||||||
labels.push(`${range[1]}ms to ${range[1] + 1}ms`);
|
// labels.push(`${range[1]}ms to ${range[1] + 1}ms`);
|
||||||
datasets[0].push(this.showPercentages ? ((lastEntry.countMiss / totalHits) * 100) : lastEntry.countMiss);
|
// console.log(`${range[1]}ms to ${range[1] + 1}ms`, range[1], lastEntry);
|
||||||
datasets[1].push(this.showPercentages ? ((lastEntry.count50 / totalHits) * 100) : lastEntry.count50);
|
// datasets[0].push(this.showPercentages ? ((lastEntry.countMiss / totalHits) * 100) : lastEntry.countMiss);
|
||||||
datasets[2].push(this.showPercentages ? ((lastEntry.count100 / totalHits) * 100) : lastEntry.count100);
|
// datasets[1].push(this.showPercentages ? ((lastEntry.count50 / totalHits) * 100) : lastEntry.count50);
|
||||||
datasets[3].push(this.showPercentages ? ((lastEntry.count300 / totalHits) * 100) : lastEntry.count300);
|
// datasets[2].push(this.showPercentages ? ((lastEntry.count100 / totalHits) * 100) : lastEntry.count100);
|
||||||
}
|
// datasets[3].push(this.showPercentages ? ((lastEntry.count300 / totalHits) * 100) : lastEntry.count300);
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
// Calculate totalHits as the sum of all counts across entriesMap before the loop
|
// Calculate totalHits as the sum of all counts across entriesMap before the loop
|
||||||
let totalHits = 0;
|
let totalHits = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user