Skip to content
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

fix bug of hyper-parameter broken when have not succeeded trial #1460

Merged
merged 14 commits into from
Aug 14, 2019
18 changes: 11 additions & 7 deletions src/webui/src/components/trial-detail/Para.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,19 @@ class Para extends React.Component<ParaProps, ParaState> {
},
axisLabel: {
formatter: function (value: string) {
const length = value.length;
if (length > 16) {
const temp = value.split('');
for (let m = 16; m < temp.length; m += 17) {
temp[m] += '\n';
if (value !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type annotation says it can't be undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, will add it.

const length = value.length;
if (length > 16) {
const temp = value.split('');
for (let m = 16; m < temp.length; m += 17) {
temp[m] += '\n';
}
return temp.join('');
Copy link
Contributor

@liuzhe-lz liuzhe-lz Aug 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to split the string into 17-char chunks with substring/slice and then join them with \n.
Just a personal opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I will try it in next version.

} else {
return value;
}
return temp.join('');
} else {
return value;
return null;
}
}
},
Expand Down