mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-10-29 13:20:48 +08:00
Use enum for PlotType
This commit is contained in:
1 parent
4147b01c56
commit
aef91deac2
2 files changed
+7
-4
No files matched your search
@@ -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<PlotResponse> => {
|
||||
return axiosInstance
|
||||
.get<PlotResponse>(`/api/studies/${studyId}/plot/${plotName}`)
|
||||
.get<PlotResponse>(`/api/studies/${studyId}/plot/${plotType}`)
|
||||
.then<PlotResponse>((res) => res.data)
|
||||
}
|
||||
@@ -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)
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user