diff --git a/optuna_dashboard/_app.py b/optuna_dashboard/_app.py
index ac0e1cf0..997c89b6 100644
--- a/optuna_dashboard/_app.py
+++ b/optuna_dashboard/_app.py
@@ -283,6 +283,8 @@ def create_app(
fig = optuna.visualization.plot_rank(study)
elif plot_type == "edf":
fig = optuna.visualization.plot_edf(study)
+ elif plot_type == "timeline":
+ fig = optuna.visualization.plot_timeline(study)
else:
response.status = 404 # Not found
return {"reason": f"plot_type={plot_type} is not supported."}
diff --git a/optuna_dashboard/ts/apiClient.ts b/optuna_dashboard/ts/apiClient.ts
index 14566a07..b6b25171 100644
--- a/optuna_dashboard/ts/apiClient.ts
+++ b/optuna_dashboard/ts/apiClient.ts
@@ -452,6 +452,7 @@ export enum PlotType {
ParallelCoordinate = "parallel_coordinate",
Rank = "rank",
EDF = "edf",
+ Timeline = "timeline",
}
export const getPlotAPI = (
studyId: number,
diff --git a/optuna_dashboard/ts/components/GraphTimeline.tsx b/optuna_dashboard/ts/components/GraphTimeline.tsx
index e9de2c71..f048a696 100644
--- a/optuna_dashboard/ts/components/GraphTimeline.tsx
+++ b/optuna_dashboard/ts/components/GraphTimeline.tsx
@@ -3,12 +3,45 @@ import React, { FC, useEffect } from "react"
import { Card, CardContent, Grid, Typography, useTheme } from "@mui/material"
import { makeHovertext } from "../graphUtil"
import { usePlotlyColorTheme } from "../state"
+import { getPlotAPI, PlotType } from "../apiClient"
+import { useBackendRender } from "../state"
const plotDomId = "graph-timeline"
const maxBars = 100
export const GraphTimeline: FC<{
study: StudyDetail | null
+}> = ({ study }) => {
+ if (useBackendRender()) {
+ return
+ } else {
+ return
+ }
+}
+
+const GraphTimelineBackend: FC<{
+ study: StudyDetail | null
+}> = ({ study }) => {
+ const studyId = study?.id
+ const numCompletedTrials =
+ study?.trials.filter((t) => t.state === "Complete").length || 0
+ useEffect(() => {
+ if (studyId === undefined) {
+ return
+ }
+ getPlotAPI(studyId, PlotType.Timeline)
+ .then(({ data, layout }) => {
+ plotly.react(plotDomId, data, layout)
+ })
+ .catch((err) => {
+ console.error(err)
+ })
+ }, [studyId, numCompletedTrials])
+ return
+}
+
+const GraphTimelineFrontend: FC<{
+ study: StudyDetail | null
}> = ({ study }) => {
const theme = useTheme()
const colorTheme = usePlotlyColorTheme(theme.palette.mode)