mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-13 12:50:51 +08:00
Update optuna_dashboard/ts/components/GraphTimeline.tsx
Co-authored-by: Hideaki Imamura <38826298+HideakiImamura@users.noreply.github.com>
This commit is contained in:
co-authored by
Hideaki Imamura
parent
6bec7e3a80
commit
e0bc525732
@@ -112,12 +112,12 @@ const plotTimeline = (trials: Trial[], mode: string) => {
|
||||
}
|
||||
|
||||
const traces: Partial<plotly.PlotData>[] = []
|
||||
for (const s of Object.keys(cm) as TrialState[]) {
|
||||
const bars = trials.filter((t) => t.state === s)
|
||||
for (const [state, color] of Object.entries(cm)) {
|
||||
const bars = trials.filter((t) => t.state === state)
|
||||
if (bars.length === 0) {
|
||||
continue
|
||||
}
|
||||
if (s == "Complete") {
|
||||
if (state == "Complete") {
|
||||
const feasibleTrials = bars.filter((t) =>
|
||||
t.constraints.every((c) => c <= 0)
|
||||
)
|
||||
@@ -125,14 +125,15 @@ const plotTimeline = (trials: Trial[], mode: string) => {
|
||||
t.constraints.some((c) => c > 0)
|
||||
)
|
||||
if (feasibleTrials.length > 0) {
|
||||
traces.push(makeTrace(feasibleTrials, "Complete", cm[s]))
|
||||
traces.push(makeTrace(feasibleTrials, "Complete", color))
|
||||
}
|
||||
if (infeasibleTrials.length > 0) {
|
||||
traces.push(makeTrace(infeasibleTrials, "Infeasible", "#cccccc"))
|
||||
}
|
||||
} else {
|
||||
traces.push(makeTrace(bars, s, cm[s]))
|
||||
traces.push(makeTrace(bars, state, color))
|
||||
}
|
||||
}
|
||||
}
|
||||
plotly.react(plotDomId, traces, layout)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user