From 5ee6758cb586d825cdfe9ec19db4cf8d5572fe1a Mon Sep 17 00:00:00 2001 From: c-bata Date: Sun, 28 Feb 2021 17:39:40 +0900 Subject: [PATCH] Refactor GraphSlice.tsx --- .../static/components/GraphSlice.tsx | 42 ++++++------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/optuna_dashboard/static/components/GraphSlice.tsx b/optuna_dashboard/static/components/GraphSlice.tsx index bcf87626..f59657dd 100644 --- a/optuna_dashboard/static/components/GraphSlice.tsx +++ b/optuna_dashboard/static/components/GraphSlice.tsx @@ -223,37 +223,19 @@ const plotSlice = (study: StudyDetail, objectiveId: number, xAxis: string) => { }, }, ] - updateLayout = { - title: "Slice", - margin: { - l: 50, - r: 50, + updateLayout["xaxis"] = { + title: paramName, + zerolinecolor: "#f2f5fa", + zerolinewidth: 1.5, + linecolor: "#f2f5fa", + linewidth: 5, + gridcolor: "#f2f5fa", + gridwidth: 1, + tickfont: { + color: "#000000", }, - xaxis: { - title: paramName, - zerolinecolor: "#f2f5fa", - zerolinewidth: 1.5, - linecolor: "#f2f5fa", - linewidth: 5, - gridcolor: "#f2f5fa", - gridwidth: 1, - tickfont: { - color: "#000000", - }, - tickvals: tickvals, - ticktext: vocabArr, - }, - yaxis: { - title: "Objective Values", - zerolinecolor: "#f2f5fa", - zerolinewidth: 2, - linecolor: "#f2f5fa", - linewidth: 5, - gridcolor: "#f2f5fa", - gridwidth: 1, - }, - plot_bgcolor: "#E5ecf6", - showlegend: false, + tickvals: tickvals, + ticktext: vocabArr, } plotly.react(plotDomId, trace, updateLayout) }