diff --git a/optuna_dashboard/ts/apiClient.ts b/optuna_dashboard/ts/apiClient.ts index d50cd938..d364b676 100644 --- a/optuna_dashboard/ts/apiClient.ts +++ b/optuna_dashboard/ts/apiClient.ts @@ -445,11 +445,14 @@ type PlotResponse = { data: plotly.Data[] layout: plotly.Layout } +export enum PlotType { + Contour = "contour", +} export const getPlotAPI = ( studyId: number, - plotName: string + plotType: PlotType ): Promise => { return axiosInstance - .get(`/api/studies/${studyId}/plot/${plotName}`) + .get(`/api/studies/${studyId}/plot/${plotType}`) .then((res) => res.data) } diff --git a/optuna_dashboard/ts/components/GraphContour.tsx b/optuna_dashboard/ts/components/GraphContour.tsx index b6ab313e..d7c05d3f 100644 --- a/optuna_dashboard/ts/components/GraphContour.tsx +++ b/optuna_dashboard/ts/components/GraphContour.tsx @@ -16,7 +16,7 @@ import { plotlyDarkTemplate } from "./PlotlyDarkMode" import { useMergedUnionSearchSpace } from "../searchSpace" import { getAxisInfo } from "../graphUtil" import { useQuery } from "../urlQuery" -import { getPlotAPI } from "../apiClient" +import { getPlotAPI, PlotType } from "../apiClient" const plotDomId = "graph-contour" @@ -39,7 +39,7 @@ const ContourBackend: FC<{ if (studyId === undefined) { return } - getPlotAPI(studyId, "contour") + getPlotAPI(studyId, PlotType.Contour) .then(({ data, layout }) => { plotly.react(plotDomId, data, layout) })