Leaflet.Heightgraph icon indicating copy to clipboard operation
Leaflet.Heightgraph copied to clipboard

Distance offset and zoom behaviour

Open jaluebbe opened this issue 5 years ago • 4 comments

The Heightgraph provides a great overview even for long tracks of several 100km. However, local details of this track may be of interest but are not visible as their length is short compared to the graph. An thinkable option to circumvent this could be to create a second Heightgraph window which shows the graph for the selected area only (maybe there are much better solutions). To realise this, two options would be nice to have when initialising Heightgraph:

  1. provide an offset for the distance axis, e.g. to start counting the distance with 112.5km.
  2. provide a callback function when _dragEndHandler is called. It could supply the distance values where the zoomed area starts/ends or even provide a geojson of the selected track segment which could be fed into the second instance of Heightgraph where the distance offset is applied.

jaluebbe avatar Feb 05 '20 18:02 jaluebbe

Good idea, thanks for the proposal! To throw some alternatives in the ring:

When you select a part of the elevation by dragging the mouse, the map zooms to that area. We could also "zoom" the heightgraph. When we zoom out again, the zoom is reset to default.

Using your solution with multiple heightgraphs is interesting as well. Maybe we could allow showing multiple heightgraphs on one page. This would require to specify a container for the heightgraph. Therefore the heightgraph could be shown outside of the map as well, which might be interesting for some use cases as well. Once we can show multiple heightgraphs programmatically some callback function could allow any application to create another heightgraph for different use cases.

In any case, PRs are welcome :)

boldtrn avatar Feb 10 '20 08:02 boldtrn

Zooming the Heightgraph while showing the proper distance axis segment sounds interesting and is exactly what I need.

jaluebbe avatar Feb 10 '20 09:02 jaluebbe

Multiple Heightgraphs on one page could be interesting as well. It could be e.g. a comparison of GPS altitude, barometric and elevation model data. Or viewing surface type and steepness at the same time.

jaluebbe avatar Feb 10 '20 09:02 jaluebbe

Leaflet.Elevation has a pending PR #65 Zoom elevation plot that supposedly also zooms the current graph when dragging a zoom range, maybe something to copy from (also MIT License).

nrenner avatar May 16 '22 17:05 nrenner