-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use tslib's PlotHistory in optuna-dashboard #928
Use tslib's PlotHistory in optuna-dashboard #928
Conversation
c039577
to
c1802ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks almost good to me! I left just one comment.
const element = document.getElementById(plotDomId) | ||
if (element !== null && studies.length >= 1) { | ||
// @ts-ignore | ||
element.on("plotly_click", (data) => { | ||
if (data.points[0].data.mode !== "lines") { | ||
let studyId = 1 | ||
if (data.points[0].data.name.includes("Infeasible Trial of")) { | ||
const studyInfo: { id: number; name: string }[] = [] | ||
studies.forEach((study) => { | ||
studyInfo.push({ id: study.id, name: study.name }) | ||
}) | ||
const dataPointStudyName = data.points[0].data.name.replace( | ||
"Infeasible Trial of ", | ||
"" | ||
) | ||
const targetId = studyInfo.find( | ||
(s) => s.name === dataPointStudyName | ||
)?.id | ||
if (targetId !== undefined) { | ||
studyId = targetId | ||
} | ||
} else { | ||
studyId = studies[Math.floor(data.points[0].curveNumber / 2)].id | ||
} | ||
navigate( | ||
url_prefix + | ||
`/studies/${studyId}/trials?numbers=${data.points[0].x}` | ||
) | ||
} | ||
}) | ||
return () => { | ||
// @ts-ignore | ||
element.removeAllListeners("plotly_click") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this part is missing in tslib/react/src/components/PlotHistory.tsx
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed this part. Thank you.
@porink0424 I followed your suggestion, and implemented it like we did it for TrialTable. |
LGTM! |
Contributor License Agreement
This repository (
optuna-dashboard
) and Goptuna share common code.This pull request may therefore be ported to Goptuna.
Make sure that you understand the consequences concerning licenses and check the box below if you accept the term before creating this pull request.
Reference Issues/PRs
NA
What does this implement/fix? Explain your changes.
Use tslib's PlotHistory in optuna-dashboard