Swapped ascent/descent from km/mi to m/ft
This commit is contained in:
parent
721937e425
commit
8c5e3cf2e4
@ -137,13 +137,17 @@
|
||||
const total: number = context.chart.data.datasets
|
||||
.map((d) => d.data[context.dataIndex])
|
||||
.reduce((total, value) => getSum(total, value), 0)
|
||||
let unitFrom = 'km'
|
||||
if (props.displayedData === 'total_ascent' || props.displayedData === 'total_descent')
|
||||
unitFrom = 'm'
|
||||
return context.datasetIndex ===
|
||||
props.displayedSportIds.length - 1 && total > 0
|
||||
? formatTooltipValue(
|
||||
props.displayedData,
|
||||
total,
|
||||
props.useImperialUnits,
|
||||
false
|
||||
false,
|
||||
unitFrom
|
||||
)
|
||||
: null
|
||||
}
|
||||
|
@ -6,9 +6,9 @@ export const formatTooltipValue = (
|
||||
displayedData: TStatisticsDatasetKeys,
|
||||
value: number,
|
||||
useImperialUnits: boolean,
|
||||
formatWithUnits = true
|
||||
formatWithUnits = true,
|
||||
unitFrom = 'km'
|
||||
): string => {
|
||||
const unitFrom = 'km'
|
||||
const unitTo = useImperialUnits ? units[unitFrom].defaultTarget : unitFrom
|
||||
switch (displayedData) {
|
||||
case 'average_speed':
|
||||
@ -16,10 +16,9 @@ export const formatTooltipValue = (
|
||||
case 'total_duration':
|
||||
return formatDuration(value, formatWithUnits)
|
||||
case 'total_distance':
|
||||
return `${value.toFixed(2)} ${unitTo}`
|
||||
case 'total_ascent':
|
||||
case 'total_descent':
|
||||
return `${(value / 1000).toFixed(2)} ${unitTo}`
|
||||
return `${value.toFixed(2)} ${unitTo}`
|
||||
default:
|
||||
return value.toString()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user