fix: 统一指标榜单数值精度
This commit is contained in:
@@ -1567,7 +1567,14 @@ const getMetricTopBarPercent = (value) => {
|
|||||||
const formatMetricTopValue = (item) => {
|
const formatMetricTopValue = (item) => {
|
||||||
const value = Number(item?.value) || 0
|
const value = Number(item?.value) || 0
|
||||||
if (item?.unit === '%' || metricTopMetric.value.endsWith('_percent')) return `${value.toFixed(2)}%`
|
if (item?.unit === '%' || metricTopMetric.value.endsWith('_percent')) return `${value.toFixed(2)}%`
|
||||||
return formatSpeedAuto(value)
|
const units = [
|
||||||
|
{ threshold: 1073741824, divisor: 1073741824, label: 'GB/s' },
|
||||||
|
{ threshold: 1048576, divisor: 1048576, label: 'MB/s' },
|
||||||
|
{ threshold: 1024, divisor: 1024, label: 'KB/s' }
|
||||||
|
]
|
||||||
|
const unit = units.find(option => Math.abs(value) >= option.threshold)
|
||||||
|
if (unit) return `${(value / unit.divisor).toFixed(2)} ${unit.label}`
|
||||||
|
return `${value.toFixed(2)} B/s`
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatMetricTopSampleTime = (value) => {
|
const formatMetricTopSampleTime = (value) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user