From 37f0709bc85ac3949898ea6b28b27d2d81fa828c Mon Sep 17 00:00:00 2001 From: hrntsm Date: Sun, 24 Sep 2023 21:53:34 +0900 Subject: [PATCH] Update redirect to work with multi studies --- optuna_dashboard/ts/components/GraphHistory.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/optuna_dashboard/ts/components/GraphHistory.tsx b/optuna_dashboard/ts/components/GraphHistory.tsx index 52c3fceb..da09fb60 100644 --- a/optuna_dashboard/ts/components/GraphHistory.tsx +++ b/optuna_dashboard/ts/components/GraphHistory.tsx @@ -70,12 +70,14 @@ export const GraphHistory: FC<{ markerSize ) const element = document.getElementById(plotDomId) - if (element != null && studies.length === 1) { + if (element != null && studies.length >= 1) { // @ts-ignore element.on("plotly_click", function (data) { const link = URL_PREFIX + - `/studies/${studies[0].id}/trials?numbers=${data.points[0].x}` + `/studies/${ + studies[Math.floor(data.points[0].curveNumber / 2)].id + }/trials?numbers=${data.points[0].x}` window.location.href = link }) return () => {