-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Add plot to redirect click event #625
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #625 +/- ##
==========================================
+ Coverage 56.40% 62.45% +6.04%
==========================================
Files 35 35
Lines 2193 2224 +31
==========================================
+ Hits 1237 1389 +152
+ Misses 956 835 -121 ☔ View full report in Codecov by Sentry. |
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.
Alghouth I left some nits comment, It works well in my local.
element.on("plotly_click", function (data) { | ||
const link = | ||
URL_PREFIX + | ||
`/studies/${studies[0].id}}/trials?numbers=${data.points[0].x}` |
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.
In this ref, it seems that we can get curveNumber
from data.
How about replace studies[0]
to studies[Math.floor(data.points[0].curveNumber / 2)]
? In that case, it also work with studies.length >=1
.
element.on("plotly_click", function (data) { | ||
const link = | ||
URL_PREFIX + | ||
`/studies/${studies[0].id}}/trials?numbers=${data.points[0].x}` |
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.
[nits] It seems to have redundant }
here.
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.
As a result, the url became something like http://localhost:8080/dashboard/studies/0%7D/trials?numbers=0
, where %7D
comes from }
.
) | ||
const link = | ||
URL_PREFIX + | ||
`/studies/${study.id}}/trials?numbers=${plotTextInfo.number}` |
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.
[nits] It seems to have redundant } here.
Thanks for the review @keisuke-umezawa . |
if (element != null && studies.length >= 1) { | ||
// @ts-ignore | ||
element.on("plotly_click", function (data) { | ||
if (data.points[0].data.mode !== "lines") { |
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.
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.
Thank you for your pull request! I left a suggestion.
const link = | ||
URL_PREFIX + | ||
`/studies/${ | ||
studies[Math.floor(data.points[0].curveNumber / 2)].id | ||
}/trials?numbers=${data.points[0].x}` | ||
window.location.href = link |
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.
Could you use useNavigate()
to avoid the page refresh?
const navigate = useNavigate() |
const link = | |
URL_PREFIX + | |
`/studies/${ | |
studies[Math.floor(data.points[0].curveNumber / 2)].id | |
}/trials?numbers=${data.points[0].x}` | |
window.location.href = link | |
navigate( | |
URL_PREFIX + | |
`/studies/${ | |
studies[Math.floor(data.points[0].curveNumber / 2)].id | |
}/trials?numbers=${data.points[0].x}` | |
) |
const link = | ||
URL_PREFIX + | ||
`/studies/${study.id}/trials?numbers=${plotTextInfo.number}` | ||
window.location.href = link |
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.
ditto.
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 | ||
} |
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.
It did not work for Infeasible trials and has been corrected.
StudyId is identified from the name string of the point, but if you have a better way, please comment.
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.
One solution would be to give each plot a little more information, like a Pareto chart.
If this is a good solution, I will create another PR on this and as soon as that it is merged, I will reflect it in this PR.
@c-bata |
This pull request has not seen any recent activity. |
@porink0424 Could you review this PR? |
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.
LGTM,
although I found some (tiny) format problems, I am going to make a follow-up PR.
I think this PR itself can be merged.
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
What does this implement/fix? Explain your changes.
To make it easier to check the results, it make possible to jump to the details of the trial from the history and pareto-front plots.
Screen.Recording.2023-09-22.at.21.18.13.mov