From 2f576e81354f45843176d1fd7929f99c1b8359e4 Mon Sep 17 00:00:00 2001 From: c-bata Date: Fri, 17 Feb 2023 23:01:18 +0900 Subject: [PATCH] Change yAxis title when user attribute is selected --- optuna_dashboard/ts/components/GraphHistory.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/optuna_dashboard/ts/components/GraphHistory.tsx b/optuna_dashboard/ts/components/GraphHistory.tsx index e558c19c..1a12c491 100644 --- a/optuna_dashboard/ts/components/GraphHistory.tsx +++ b/optuna_dashboard/ts/components/GraphHistory.tsx @@ -53,7 +53,8 @@ export const GraphHistory: FC<{ selected, xAxis, betaLogScale === undefined ? logScale : betaLogScale, - theme.palette.mode + theme.palette.mode, + study?.objective_names ) } }, [ @@ -64,6 +65,7 @@ export const GraphHistory: FC<{ betaLogScale, xAxis, theme.palette.mode, + study?.objective_names, ]) const handleObjectiveChange = (event: SelectChangeEvent) => { @@ -207,7 +209,8 @@ const plotHistory = ( target: Target, xAxis: "number" | "datetime_start" | "datetime_complete", logScale: boolean, - mode: string + mode: string, + objectiveNames?: string[] ) => { if (document.getElementById(plotDomId) === null) { return @@ -221,7 +224,7 @@ const plotHistory = ( b: 0, }, yaxis: { - title: "Objective Value", + title: target.toLabel(objectiveNames), type: logScale ? "log" : "linear", }, xaxis: { @@ -248,7 +251,7 @@ const plotHistory = ( { x: trials.map(getAxisX), y: trials.map((t: Trial): number => target.getTargetValue(t) as number), - name: "Objective Value", + name: target.toLabel(objectiveNames), mode: "markers", type: "scatter", },