diff --git a/frontend/packages/core/public/locales/en/scalar.json b/frontend/packages/core/public/locales/en/scalar.json index c550a0c6c6b71e494fd9eb5a9c7d6bb6e8b2355d..19655adeccaa0d91767b9853be6ec170544c17c5 100644 --- a/frontend/packages/core/public/locales/en/scalar.json +++ b/frontend/packages/core/public/locales/en/scalar.json @@ -1,11 +1,12 @@ { "download-image": "Download image", "ignore-outliers": "Ignore outliers in chart scaling", - "max": "Max", + "max": "Max.", "maximize": "Maximize", - "min": "Min", + "min": "Min.", "minimize": "Minimize", "restore": "Selection restore", + "show-most-value": "Show global extrema", "smoothed": "Smoothed", "smoothed-data-only": "Smoothed Data Only", "smoothing": "Smoothing", diff --git a/frontend/packages/core/public/locales/zh/scalar.json b/frontend/packages/core/public/locales/zh/scalar.json index cb8c154c880659c3b6d468d9ce98fd7a57523921..495cf6bc6780770ccdcec45cf4393c2028b5026f 100644 --- a/frontend/packages/core/public/locales/zh/scalar.json +++ b/frontend/packages/core/public/locales/zh/scalar.json @@ -6,6 +6,7 @@ "min": "最小值", "minimize": "最小化", "restore": "还原图表框选", + "show-most-value": "显示最值", "smoothed": "Smoothed", "smoothed-data-only": "仅显示平滑后数据", "smoothing": "平滑度", diff --git a/frontend/packages/core/src/components/ScalarPage/ScalarChart.tsx b/frontend/packages/core/src/components/ScalarPage/ScalarChart.tsx index 39c3ec46fefedf4d83df681d87730567c00a9eca..49cacc220c8d6e10c9d7d826dfcdf756e81fd045 100644 --- a/frontend/packages/core/src/components/ScalarPage/ScalarChart.tsx +++ b/frontend/packages/core/src/components/ScalarPage/ScalarChart.tsx @@ -87,6 +87,7 @@ type ScalarChartProps = { sortingMethod: SortingMethod; outlier?: boolean; smoothedOnly?: boolean; + showMostValue?: boolean; running?: boolean; }; @@ -99,6 +100,7 @@ const ScalarChart: FunctionComponent = ({ sortingMethod, outlier, smoothedOnly, + showMostValue, running }) => { const {t, i18n} = useTranslation(['scalar', 'common']); @@ -132,7 +134,10 @@ const ScalarChart: FunctionComponent = ({ [datasets, smoothing] ); const smoothedDatasetsOrUndefined = useHeavyWork(smoothWasm, null, transform, transformParams); - const smoothedDatasets = useMemo(() => smoothedDatasetsOrUndefined ?? [], [smoothedDatasetsOrUndefined]); + const smoothedDatasets = useMemo>( + () => smoothedDatasetsOrUndefined ?? [], + [smoothedDatasetsOrUndefined] + ); const axisRangeParams = useMemo( () => ({ @@ -164,11 +169,12 @@ const ScalarChart: FunctionComponent = ({ () => chartData({ data: smoothedDatasets.slice(0, runs.length), + ranges: showMostValue ? datasetRanges ?? [] : [], runs, xAxis, smoothedOnly }), - [smoothedDatasets, runs, xAxis, smoothedOnly] + [smoothedDatasets, datasetRanges, runs, xAxis, smoothedOnly, showMostValue] ); const maxStepLength = useMemo( diff --git a/frontend/packages/core/src/pages/scalar.tsx b/frontend/packages/core/src/pages/scalar.tsx index 04076ec28b5d117ef400ffc8ab0b46ec5aa5acbf..ac52be67d0b1af4ceeaf9a48934414a03f7fd36f 100644 --- a/frontend/packages/core/src/pages/scalar.tsx +++ b/frontend/packages/core/src/pages/scalar.tsx @@ -59,6 +59,8 @@ const Scalar: FunctionComponent = () => { const [smoothedDataOnly, setSmoothedDataOnly] = useState(false); + const [showMostValue, setShowMostValue] = useState(false); + const aside = useMemo( () => runs.length ? ( @@ -70,9 +72,16 @@ const Scalar: FunctionComponent = () => { onToggleRunning={setRunning} > - - {t('scalar:ignore-outliers')} - + + + {t('scalar:ignore-outliers')} + + + + + {t('scalar:show-most-value')} + + {t('scalar:tooltip-sorting')}