@@ -12,10 +12,6 @@ let timeseriesData, barChartsData, allRunNames;
1212// DOM Elements
1313let runSelect , selectedRunsDiv , suiteFiltersContainer ;
1414
15- // Add this at the top of the file with the other variable declarations
16- let showNotes = true ;
17- let showUnstable = false ;
18-
1915// Run selector functions
2016function updateSelectedRuns ( forceUpdate = true ) {
2117 selectedRunsDiv . innerHTML = '' ;
@@ -109,7 +105,10 @@ function createChart(data, containerId, type) {
109105 }
110106 } ;
111107 options . scales . x = {
112- type : 'time' ,
108+ type : 'timeseries' ,
109+ time : {
110+ unit : 'day'
111+ } ,
113112 ticks : {
114113 maxRotation : 45 ,
115114 minRotation : 45 ,
@@ -215,7 +214,7 @@ function createChartContainer(data, canvasId, type) {
215214 const unstableWarning = document . createElement ( 'div' ) ;
216215 unstableWarning . className = 'benchmark-unstable' ;
217216 unstableWarning . textContent = metadata . unstable ;
218- unstableWarning . style . display = showUnstable ? 'block' : 'none' ;
217+ unstableWarning . style . display = isUnstableEnabled ( ) ? 'block' : 'none' ;
219218 container . appendChild ( unstableWarning ) ;
220219 }
221220
@@ -224,7 +223,7 @@ function createChartContainer(data, canvasId, type) {
224223 const noteElement = document . createElement ( 'div' ) ;
225224 noteElement . className = 'benchmark-note' ;
226225 noteElement . textContent = metadata . notes ;
227- noteElement . style . display = showNotes ? 'block' : 'none' ;
226+ noteElement . style . display = isNotesEnabled ( ) ? 'block' : 'none' ;
228227 container . appendChild ( noteElement ) ;
229228 }
230229
@@ -390,8 +389,8 @@ function updateURL() {
390389 }
391390
392391 // Add toggle states to URL
393- url . searchParams . set ( 'notes' , showNotes ) ;
394- url . searchParams . set ( 'unstable' , showUnstable ) ;
392+ url . searchParams . set ( 'notes' , isNotesEnabled ( ) ) ;
393+ url . searchParams . set ( 'unstable' , isUnstableEnabled ( ) ) ;
395394
396395 history . replaceState ( null , '' , url ) ;
397396}
@@ -409,16 +408,11 @@ function filterCharts() {
409408 // Hide unstable benchmarks if showUnstable is false
410409 const shouldShow = regex . test ( label ) &&
411410 activeSuites . includes ( suite ) &&
412- ( showUnstable || ! isUnstable ) ;
411+ ( isUnstableEnabled ( ) || ! isUnstable ) ;
413412
414413 container . style . display = shouldShow ? '' : 'none' ;
415414 } ) ;
416415
417- // Update notes visibility
418- document . querySelectorAll ( '.benchmark-note' ) . forEach ( note => {
419- note . style . display = showNotes ? 'block' : 'none' ;
420- } ) ;
421-
422416 updateURL ( ) ;
423417}
424418
@@ -464,7 +458,7 @@ function processTimeseriesData(benchmarkRuns) {
464458function processBarChartsData ( benchmarkRuns ) {
465459 const groupedResults = { } ;
466460
467- benchmarkRuns . forEach ( run => {
461+ benchmarkRuns . reverse ( ) . forEach ( run => {
468462 run . results . forEach ( result => {
469463 if ( ! result . explicit_group ) return ;
470464
@@ -547,24 +541,31 @@ function setupSuiteFilters() {
547541 } ) ;
548542}
549543
544+ function isNotesEnabled ( ) {
545+ const notesToggle = document . getElementById ( 'show-notes' ) ;
546+ return notesToggle . checked ;
547+ }
548+
549+ function isUnstableEnabled ( ) {
550+ const unstableToggle = document . getElementById ( 'show-unstable' ) ;
551+ return unstableToggle . checked ;
552+ }
553+
550554function setupToggles ( ) {
551555 const notesToggle = document . getElementById ( 'show-notes' ) ;
552556 const unstableToggle = document . getElementById ( 'show-unstable' ) ;
553557
554558 notesToggle . addEventListener ( 'change' , function ( ) {
555- showNotes = this . checked ;
556559 // Update all note elements visibility
557560 document . querySelectorAll ( '.benchmark-note' ) . forEach ( note => {
558- note . style . display = showNotes ? 'block' : 'none' ;
561+ note . style . display = isNotesEnabled ( ) ? 'block' : 'none' ;
559562 } ) ;
560- filterCharts ( ) ;
561563 } ) ;
562564
563565 unstableToggle . addEventListener ( 'change' , function ( ) {
564- showUnstable = this . checked ;
565566 // Update all unstable warning elements visibility
566567 document . querySelectorAll ( '.benchmark-unstable' ) . forEach ( warning => {
567- warning . style . display = showUnstable ? 'block' : 'none' ;
568+ warning . style . display = isUnstableEnabled ( ) ? 'block' : 'none' ;
568569 } ) ;
569570 filterCharts ( ) ;
570571 } ) ;
@@ -574,12 +575,12 @@ function setupToggles() {
574575 const unstableParam = getQueryParam ( 'unstable' ) ;
575576
576577 if ( notesParam !== null ) {
577- showNotes = notesParam === 'true' ;
578+ let showNotes = notesParam === 'true' ;
578579 notesToggle . checked = showNotes ;
579580 }
580581
581582 if ( unstableParam !== null ) {
582- showUnstable = unstableParam === 'true' ;
583+ let showUnstable = unstableParam === 'true' ;
583584 unstableToggle . checked = showUnstable ;
584585 }
585586}
0 commit comments