aboutsummaryrefslogtreecommitdiff
path: root/modern/src/reports
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-07-05 16:43:42 -0700
committerAnton Tananaev <anton@traccar.org>2022-07-05 16:43:42 -0700
commit8bde80a8cd1fb9b92f4867edbeeae48158f9036b (patch)
tree493edc77a38e4e39b438c4255a02cf843eedc821 /modern/src/reports
parentdad1892d4718f15c9ecdd301db140d66d52da6b3 (diff)
downloadtrackermap-web-8bde80a8cd1fb9b92f4867edbeeae48158f9036b.tar.gz
trackermap-web-8bde80a8cd1fb9b92f4867edbeeae48158f9036b.tar.bz2
trackermap-web-8bde80a8cd1fb9b92f4867edbeeae48158f9036b.zip
Configurable altitude units
Diffstat (limited to 'modern/src/reports')
-rw-r--r--modern/src/reports/ChartReportPage.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/modern/src/reports/ChartReportPage.js b/modern/src/reports/ChartReportPage.js
index 977c5158..00edf7b6 100644
--- a/modern/src/reports/ChartReportPage.js
+++ b/modern/src/reports/ChartReportPage.js
@@ -13,7 +13,9 @@ import ReportsMenu from './components/ReportsMenu';
import usePositionAttributes from '../common/attributes/usePositionAttributes';
import { useCatch } from '../reactHelper';
import { useAttributePreference } from '../common/util/preferences';
-import { distanceFromMeters, speedFromKnots, volumeFromLiters } from '../common/util/converter';
+import {
+ altitudeFromMeters, distanceFromMeters, speedFromKnots, volumeFromLiters,
+} from '../common/util/converter';
import useReportStyles from './common/useReportStyles';
const ChartReportPage = () => {
@@ -23,6 +25,7 @@ const ChartReportPage = () => {
const positionAttributes = usePositionAttributes(t);
const distanceUnit = useAttributePreference('distanceUnit');
+ const altitudeUnit = useAttributePreference('altitudeUnit');
const speedUnit = useAttributePreference('speedUnit');
const volumeUnit = useAttributePreference('volumeUnit');
@@ -51,6 +54,9 @@ const ChartReportPage = () => {
case 'speed':
formatted[key] = speedFromKnots(value, speedUnit).toFixed(2);
break;
+ case 'altitude':
+ formatted[key] = altitudeFromMeters(value, altitudeUnit).toFixed(2);
+ break;
case 'distance':
formatted[key] = distanceFromMeters(value, distanceUnit).toFixed(2);
break;