[U] Use Q1 instead of min

This commit is contained in:
2025-04-15 22:07:56 -04:00
committed by GitHub
parent 8b51af821f
commit dbbb45d2fe
+14 -7
View File
@@ -44,13 +44,20 @@ PetiteVue.createApp({
d: { logs: [] }, // timestamp, duration, start_block, end_block, bad_blocks d: { logs: [] }, // timestamp, duration, start_block, end_block, bad_blocks
max_dur: 0, min_dur: 0, hover: null, firs: null, last: null, max_dur: 0, min_dur: 0, hover: null, firs: null, last: null,
onInit() { onInit() {
this.min_dur = Math.min(...this.d.logs.map(l => l.duration)) // Extract all durations and sort them
// this.max_dur = Math.max(...this.d.logs.map(l => l.duration)) const durations = this.d.logs.map(l => l.duration).sort((a, b) => a - b);
// this.max_dur = Math.min(this.max_dur, this.min_dur * 8)
this.max_dur = this.min_dur * 8 // Compute Q1 index; you can choose to do an interpolation if you need higher accuracy
console.log(`Min duration: ${this.min_dur}, Max duration: ${this.max_dur}`) const q1Index = Math.floor(durations.length * 0.25);
this.first = this.d.logs[0]
this.last = this.d.logs[this.d.logs.length - 1] // Use Q1 as our new "min"
this.min_dur = durations[q1Index];
this.max_dur = this.min_dur * 8;
console.log(`Q1 duration: ${this.min_dur}, Max duration: ${this.max_dur}`);
this.first = this.d.logs[0];
this.last = this.d.logs[this.d.logs.length - 1];
}, },
mounted() { mounted() {
if (this.d.logs.length) return this.onInit() // For injecting data from server-side if (this.d.logs.length) return this.onInit() // For injecting data from server-side