add elevation profile component to documentation, closes #217

This commit is contained in:
Vianney Coppé
2025-05-19 23:35:56 +02:00
parent de0cc63d53
commit a3817fd5cd

View File

@@ -2,9 +2,18 @@
title: Files and statistics title: Files and statistics
--- ---
<script> <script lang="ts">
import { ChartNoAxesColumn } from 'lucide-svelte'; import { ChartNoAxesColumn } from 'lucide-svelte';
import DocsNote from '$lib/components/docs/DocsNote.svelte'; import DocsNote from '$lib/components/docs/DocsNote.svelte';
import ElevationProfile from '$lib/components/ElevationProfile.svelte';
import GPXStatistics from '$lib/components/GPXStatistics.svelte';
import { exampleGPXFile } from '$lib/assets/example';
import { writable } from 'svelte/store';
let gpxStatistics = writable(exampleGPXFile.getStatistics());
let slicedGPXStatistics = writable(undefined);
let additionalDatasets = writable(['speed', 'atemp']);
let elevationFill = writable<'slope' | 'surface' | undefined>(undefined);
</script> </script>
# { title } # { title }
@@ -71,6 +80,25 @@ Click on the profile to reset the selection.
You can also use the mouse wheel to zoom in and out on the elevation profile, and move left and right by dragging the profile while holding the <kbd>Shift</kbd> key. You can also use the mouse wheel to zoom in and out on the elevation profile, and move left and right by dragging the profile while holding the <kbd>Shift</kbd> key.
<div class="h-48 w-full">
<ElevationProfile
{gpxStatistics}
{slicedGPXStatistics}
additionalDatasets={$additionalDatasets}
elevationFill={$elevationFill}
/>
</div>
<div class="flex flex-col items-center -mt-6">
<div class="h-10 w-fit">
<GPXStatistics
{gpxStatistics}
{slicedGPXStatistics}
panelSize={120}
orientation={'horizontal'}
/>
</div>
</div>
### Additional data ### Additional data
Using the <kbd><ChartNoAxesColumn size="16" class="inline-block" style="margin-bottom: 2px"/></kbd> button at the bottom-right of the elevation profile, you can optionally color the elevation profile by: Using the <kbd><ChartNoAxesColumn size="16" class="inline-block" style="margin-bottom: 2px"/></kbd> button at the bottom-right of the elevation profile, you can optionally color the elevation profile by: