-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[webui] Update default metric tooltip #3316
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ import { Trial } from '../static/model/trial'; | |
import { AppContext } from '../App'; | ||
import { Title } from './overview/Title'; | ||
import SuccessTable from './overview/table/SuccessTable'; | ||
import Accuracy from './overview/Accuracy'; | ||
import DefaultPoint from './trial-detail/DefaultMetricPoint'; | ||
import { BasicInfo } from './overview/params/BasicInfo'; | ||
import { ExpDuration } from './overview/count/ExpDuration'; | ||
import { ExpDurationContext } from './overview/count/ExpDurationContext'; | ||
|
@@ -60,11 +60,9 @@ class Overview extends React.Component<{}, OverviewState> { | |
const bestTrials = this.findBestTrials(); | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
const bestAccuracy = bestTrials.length > 0 ? bestTrials[0].accuracy! : NaN; | ||
const accuracyGraphData = this.generateAccuracyGraph(bestTrials); | ||
const noDataMessage = bestTrials.length > 0 ? '' : 'No data'; | ||
|
||
const maxExecDuration = EXPERIMENT.profile.params.maxExecDuration; | ||
const execDuration = EXPERIMENT.profile.execDuration; | ||
|
||
return ( | ||
<AppContext.Consumer> | ||
{(value): React.ReactNode => { | ||
|
@@ -167,7 +165,12 @@ class Overview extends React.Component<{}, OverviewState> { | |
</div> | ||
</Stack> | ||
<div className='overviewChart'> | ||
<Accuracy accuracyData={accuracyGraphData} accNodata={noDataMessage} /> | ||
<DefaultPoint | ||
trialIds={bestTrials.map(trial => trial.info.trialJobId)} | ||
visible={true} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think "visible" can be handled in this level. No need to pass a property into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, here no need this |
||
chartHeight={300} | ||
isHasbestCurve={false} | ||
/> | ||
<SuccessTable | ||
trialIds={bestTrials.map(trial => trial.info.trialJobId)} | ||
updateOverviewPage={updateOverviewPage} | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,8 @@ const EmptyGraph = { | |
interface DefaultPointProps { | ||
trialIds: string[]; | ||
visible: boolean; | ||
chartHeight: number; | ||
isHasbestCurve: boolean; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest hasBestCurve There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
} | ||
|
||
interface DefaultPointState { | ||
|
@@ -69,6 +71,7 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState> | |
tooltip: { | ||
trigger: 'item', | ||
enterable: true, | ||
confine: true, // confirm always show tooltip box rather than hidden by background | ||
position: (point: number[], data: TooltipForAccuracy): number[] => [ | ||
data.data[0] < maxSequenceId ? point[0] : point[0] - 300, | ||
80 | ||
|
@@ -149,21 +152,24 @@ class DefaultPoint extends React.Component<DefaultPointProps, DefaultPointState> | |
} | ||
|
||
render(): React.ReactNode { | ||
const { isHasbestCurve, chartHeight } = this.props; | ||
const graph = this.generateGraph(); | ||
const accNodata = graph === EmptyGraph ? 'No data' : ''; | ||
const onEvents = { dataZoom: this.metricDataZoom }; | ||
|
||
return ( | ||
<div> | ||
<Stack horizontalAlign='end' className='default-metric'> | ||
<Toggle label='Optimization curve' inlineLabel onChange={this.loadDefault} /> | ||
</Stack> | ||
{isHasbestCurve && ( | ||
<Stack horizontalAlign='end' className='default-metric'> | ||
<Toggle label='Optimization curve' inlineLabel onChange={this.loadDefault} /> | ||
</Stack> | ||
)} | ||
<div className='default-metric-graph'> | ||
<ReactEcharts | ||
option={graph} | ||
style={{ | ||
width: '100%', | ||
height: 402, | ||
height: chartHeight, | ||
margin: '0 auto' | ||
}} | ||
theme='my_theme' | ||
|
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.
Maybe "nni_theme" or "nniTheme" is a better name?
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.
yes, will change it to nni_theme