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 (
10+ document . querySelectorAll < HTMLInputElement > ( "#scale-select-form input" ) ,
11+ ) ;
12+
13+ buttons . map ( ( button ) => {
14+ button . addEventListener ( "change" , ( ) => {
15+ if ( button . checked ) {
16+ scale = button . value as ScaleKind ;
17+ make_data ( ) ;
18+ }
19+ } ) ;
20+ } ) ;
521
622interface DashboardCompileBenchmarkCases {
723 clean_averages : [ number ] ;
@@ -27,9 +43,9 @@ function render(
2743 element : string ,
2844 name : Profile ,
2945 data : DashboardCompileBenchmarkCases ,
30- versions : [ string ]
46+ versions : [ string ] ,
3147) {
32- let articles = { check : "a" , debug : "a" , opt : "an" , doc : "a" } ;
48+ let articles = { check : "a" , debug : "a" , opt : "an" , doc : "a" } ;
3349
3450 Highcharts . chart ( {
3551 chart : {
@@ -43,13 +59,13 @@ function render(
4359 text : `Average time for ${ articles [ name ] } ${ name } build` ,
4460 } ,
4561 yAxis : {
46- title : { text : "Seconds" } ,
47- min : Math . min ( ... Object . keys ( data ) . flatMap ( ( key ) => data [ key ] ) ) ,
48- type : " logarithmic",
62+ title : { text : "Seconds" } ,
63+ min : scale === "linear" ? 0 : undefined ,
64+ type : scale === "log" ? " logarithmic" : undefined ,
4965 } ,
5066 xAxis : {
5167 categories : versions ,
52- title : { text : "Version" } ,
68+ title : { text : "Version" } ,
5369 } ,
5470 series : [
5571 {
@@ -100,13 +116,13 @@ function renderRuntime(element: string, data: [number], versions: [string]) {
100116 text : `Average time for a runtime benchmark` ,
101117 } ,
102118 yAxis : {
103- title : { text : "Miliseconds" } ,
104- min : Math . min ( ... formattedData ) ,
105- type : " logarithmic",
119+ title : { text : "Miliseconds" } ,
120+ min : scale === "linear" ? 0 : undefined ,
121+ type : scale === "log" ? " logarithmic" : undefined ,
106122 } ,
107123 xAxis : {
108124 categories : versions . slice ( nullCount ) ,
109- title : { text : "Version" } ,
125+ title : { text : "Version" } ,
110126 } ,
111127 series : [
112128 {
0 commit comments