From 4943e25494bd808636da7f73790f8de58fd30d9f Mon Sep 17 00:00:00 2001 From: Shina <53410646+s7tya@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:55:48 +0900 Subject: [PATCH 1/3] switch to logscale --- site/frontend/src/pages/dashboard.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/site/frontend/src/pages/dashboard.ts b/site/frontend/src/pages/dashboard.ts index e0848d3f2..83c2e01be 100644 --- a/site/frontend/src/pages/dashboard.ts +++ b/site/frontend/src/pages/dashboard.ts @@ -44,7 +44,8 @@ function render( }, yAxis: { title: {text: "Seconds"}, - min: 0, + min: 0.1, + type: "logarithmic", }, xAxis: { categories: versions, @@ -100,7 +101,8 @@ function renderRuntime(element: string, data: [number], versions: [string]) { }, yAxis: { title: {text: "Miliseconds"}, - min: 0, + min: 0.1, + type: "logarithmic", }, xAxis: { categories: versions.slice(nullCount), From 8f93b9b27ca07b49a719af6bc4ff2c0a2128b5cb Mon Sep 17 00:00:00 2001 From: Shina <53410646+s7tya@users.noreply.github.com> Date: Wed, 9 Oct 2024 19:21:28 +0900 Subject: [PATCH 2/3] set min to lowest value --- site/frontend/src/pages/dashboard.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/frontend/src/pages/dashboard.ts b/site/frontend/src/pages/dashboard.ts index 83c2e01be..d9a374af6 100644 --- a/site/frontend/src/pages/dashboard.ts +++ b/site/frontend/src/pages/dashboard.ts @@ -44,7 +44,7 @@ function render( }, yAxis: { title: {text: "Seconds"}, - min: 0.1, + min: Math.min(...Object.keys(data).flatMap((key) => data[key])), type: "logarithmic", }, xAxis: { @@ -101,7 +101,7 @@ function renderRuntime(element: string, data: [number], versions: [string]) { }, yAxis: { title: {text: "Miliseconds"}, - min: 0.1, + min: Math.min(...formattedData), type: "logarithmic", }, xAxis: { From b4f6ba671dd10e9deb4188dc480b54ccd3a77994 Mon Sep 17 00:00:00 2001 From: Shina <53410646+s7tya@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:21:11 +0900 Subject: [PATCH 3/3] add toggle between linear and log --- site/frontend/src/pages/dashboard.ts | 30 ++++++++++++++++---- site/frontend/templates/pages/dashboard.html | 11 +++++++ 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/site/frontend/src/pages/dashboard.ts b/site/frontend/src/pages/dashboard.ts index d9a374af6..51d644c79 100644 --- a/site/frontend/src/pages/dashboard.ts +++ b/site/frontend/src/pages/dashboard.ts @@ -3,6 +3,22 @@ import {DASHBOARD_DATA_URL} from "../urls"; import {getJson} from "../utils/requests"; +type ScaleKind = "linear" | "log"; +let scale: ScaleKind = "linear"; + +const buttons = Array.from( + document.querySelectorAll("#scale-select-form input") +); + +buttons.map((button) => { + button.addEventListener("change", () => { + if (button.checked) { + scale = button.value as ScaleKind; + make_data(); + } + }); +}); + interface DashboardCompileBenchmarkCases { clean_averages: [number]; base_incr_averages: [number]; @@ -44,8 +60,8 @@ function render( }, yAxis: { title: {text: "Seconds"}, - min: Math.min(...Object.keys(data).flatMap((key) => data[key])), - type: "logarithmic", + min: scale === "linear" ? 0 : undefined, + type: scale === "log" ? "logarithmic" : undefined, }, xAxis: { categories: versions, @@ -101,8 +117,8 @@ function renderRuntime(element: string, data: [number], versions: [string]) { }, yAxis: { title: {text: "Miliseconds"}, - min: Math.min(...formattedData), - type: "logarithmic", + min: scale === "linear" ? 0 : undefined, + type: scale === "log" ? "logarithmic" : undefined, }, xAxis: { categories: versions.slice(nullCount), @@ -128,8 +144,12 @@ function populate_data(response: DashboardResponse) { renderRuntime("runtime-average-times", data.runtime, data.versions); } +let response: DashboardResponse | null = null; async function make_data() { - const response = await getJson(DASHBOARD_DATA_URL); + if (!response) { + response = await getJson(DASHBOARD_DATA_URL); + } + populate_data(response); } diff --git a/site/frontend/templates/pages/dashboard.html b/site/frontend/templates/pages/dashboard.html index 8010544be..b502addea 100644 --- a/site/frontend/templates/pages/dashboard.html +++ b/site/frontend/templates/pages/dashboard.html @@ -24,6 +24,17 @@ compiled by a given version of the Rust compiler. +
+ + +
+