11import Highcharts from "highcharts" ;
2- import { DASHBOARD_DATA_URL } from "../urls" ;
2+ import { DASHBOARD_DATA_URL } from "../urls" ;
33
4- import { getJson } from "../utils/requests" ;
4+ import { getJson } from "../utils/requests" ;
5+
6+ type ScaleKind = "linear" | "log" ;
7+ let scale : ScaleKind = "linear" ;
8+
9+ const buttons = Array . from ( document . querySelectorAll < HTMLInputElement > (
10+ "#scale-select-form input" ,
11+ ) ) ;
12+
13+ console . log ( buttons ) ;
14+
15+ Array . from ( buttons ) . map ( ( button ) => {
16+ console . log ( "a" ) ;
17+ button . addEventListener ( "change" , ( ) => {
18+ console . log ( button , "click" ) ;
19+ if ( button . checked ) {
20+ scale = button . value as ScaleKind ;
21+ make_data ( ) ;
22+ }
23+ } ) ;
24+ } ) ;
525
626interface DashboardCompileBenchmarkCases {
727 clean_averages : [ number ] ;
@@ -27,9 +47,9 @@ function render(
2747 element : string ,
2848 name : Profile ,
2949 data : DashboardCompileBenchmarkCases ,
30- versions : [ string ]
50+ versions : [ string ] ,
3151) {
32- let articles = { check : "a" , debug : "a" , opt : "an" , doc : "a" } ;
52+ let articles = { check : "a" , debug : "a" , opt : "an" , doc : "a" } ;
3353
3454 Highcharts . chart ( {
3555 chart : {
@@ -43,13 +63,13 @@ function render(
4363 text : `Average time for ${ articles [ name ] } ${ name } build` ,
4464 } ,
4565 yAxis : {
46- title : { text : "Seconds" } ,
47- min : Math . min ( ... Object . keys ( data ) . flatMap ( ( key ) => data [ key ] ) ) ,
48- type : " logarithmic",
66+ title : { text : "Seconds" } ,
67+ min : scale === "linear" ? 0 : undefined ,
68+ type : scale === "log" ? " logarithmic" : undefined ,
4969 } ,
5070 xAxis : {
5171 categories : versions ,
52- title : { text : "Version" } ,
72+ title : { text : "Version" } ,
5373 } ,
5474 series : [
5575 {
@@ -100,13 +120,13 @@ function renderRuntime(element: string, data: [number], versions: [string]) {
100120 text : `Average time for a runtime benchmark` ,
101121 } ,
102122 yAxis : {
103- title : { text : "Miliseconds" } ,
104- min : Math . min ( ... formattedData ) ,
105- type : " logarithmic",
123+ title : { text : "Miliseconds" } ,
124+ min : scale === "linear" ? 0 : undefined ,
125+ type : scale === "log" ? " logarithmic" : undefined ,
106126 } ,
107127 xAxis : {
108128 categories : versions . slice ( nullCount ) ,
109- title : { text : "Version" } ,
129+ title : { text : "Version" } ,
110130 } ,
111131 series : [
112132 {
0 commit comments