1
1
import Highcharts from "highcharts" ;
2
- import { DASHBOARD_DATA_URL } from "../urls" ;
2
+ import { DASHBOARD_DATA_URL } from "../urls" ;
3
3
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
+ } ) ;
5
21
6
22
interface DashboardCompileBenchmarkCases {
7
23
clean_averages : [ number ] ;
@@ -27,9 +43,9 @@ function render(
27
43
element : string ,
28
44
name : Profile ,
29
45
data : DashboardCompileBenchmarkCases ,
30
- versions : [ string ]
46
+ versions : [ string ] ,
31
47
) {
32
- let articles = { check : "a" , debug : "a" , opt : "an" , doc : "a" } ;
48
+ let articles = { check : "a" , debug : "a" , opt : "an" , doc : "a" } ;
33
49
34
50
Highcharts . chart ( {
35
51
chart : {
@@ -43,13 +59,13 @@ function render(
43
59
text : `Average time for ${ articles [ name ] } ${ name } build` ,
44
60
} ,
45
61
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 ,
49
65
} ,
50
66
xAxis : {
51
67
categories : versions ,
52
- title : { text : "Version" } ,
68
+ title : { text : "Version" } ,
53
69
} ,
54
70
series : [
55
71
{
@@ -100,13 +116,13 @@ function renderRuntime(element: string, data: [number], versions: [string]) {
100
116
text : `Average time for a runtime benchmark` ,
101
117
} ,
102
118
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 ,
106
122
} ,
107
123
xAxis : {
108
124
categories : versions . slice ( nullCount ) ,
109
- title : { text : "Version" } ,
125
+ title : { text : "Version" } ,
110
126
} ,
111
127
series : [
112
128
{
0 commit comments