Client - [PR84/93] display elevation on statistics
This commit is contained in:
@ -45,6 +45,8 @@ export const datasetKeys: TStatisticsDatasetKeys[] = [
|
||||
'nb_workouts',
|
||||
'total_duration',
|
||||
'total_distance',
|
||||
'total_ascent',
|
||||
'total_descent',
|
||||
]
|
||||
|
||||
export const getDateKeys = (
|
||||
@ -78,12 +80,16 @@ export const getDatasets = (displayedSports: ISport[]): TStatisticsDatasets => {
|
||||
nb_workouts: [],
|
||||
total_distance: [],
|
||||
total_duration: [],
|
||||
total_ascent: [],
|
||||
total_descent: [],
|
||||
}
|
||||
displayedSports.map((sport) => {
|
||||
const color = sportColors[sport.label]
|
||||
datasets.nb_workouts.push(getStatisticsChartDataset(sport.label, color))
|
||||
datasets.total_distance.push(getStatisticsChartDataset(sport.label, color))
|
||||
datasets.total_duration.push(getStatisticsChartDataset(sport.label, color))
|
||||
datasets.total_ascent.push(getStatisticsChartDataset(sport.label, color))
|
||||
datasets.total_descent.push(getStatisticsChartDataset(sport.label, color))
|
||||
})
|
||||
return datasets
|
||||
}
|
||||
|
@ -6,9 +6,15 @@ export const formatTooltipValue = (
|
||||
value: number,
|
||||
formatWithUnits = true
|
||||
): string => {
|
||||
return displayedData === 'total_duration'
|
||||
? formatDuration(value, formatWithUnits)
|
||||
: displayedData === 'total_distance'
|
||||
? value.toFixed(2) + ' km'
|
||||
: value.toString()
|
||||
switch (displayedData) {
|
||||
case 'total_duration':
|
||||
return formatDuration(value, formatWithUnits)
|
||||
case 'total_distance':
|
||||
return value.toFixed(2) + ' km'
|
||||
case 'total_ascent':
|
||||
case 'total_descent':
|
||||
return (value / 1000).toFixed(2) + ' km'
|
||||
default:
|
||||
return value.toString()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user