Raruto / leaflet-elevation

Leaflet plugin that allows to add elevation profiles using d3js
GNU General Public License v3.0
256 stars 85 forks source link

Incorrect time shown in y-axis #292

Closed HAmamiya closed 5 months ago

HAmamiya commented 5 months ago

Hi Raruto,

First of all thanks for your project which is really useful ^^.

Subject of the issue

Incorrect time shown in y-axis

Your environment

Steps to reproduce

Use template https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_speed-chart.html with the following GeoJSON files: https://fgtracker.us.to/modules/fgtracker/interface.php?action=geojson&flightid=7675089 https://fgtracker.us.to/modules/fgtracker/interface.php?action=geojson&flightid=7675154

Expected behaviour

Time t on y-axis matches the actual time logged in GeoJSON file.

Actual behaviour

Screenshot 2024-06-08 173259

Further questions

Please allow me to ask some question here: 1) Whenimperial: true, the y-axis is in miles. Is it possible, like speed, to change miles to nautical miles? 2) label on x-axis (elevation) may become too large to feed in the graph. Screenshot_20240608_174021_Firefox

Any possible fix or workaround?

Thanks in advance, Hazuki

Raruto commented 5 months ago

Incorrect time shown in axis

Duplicate of: https://github.com/Raruto/leaflet-elevation/issues/170

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/handlers/speed.js#L8

Is it possible, like speed, to change miles to nautical miles?

Here's the relevant code:

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/handlers/speed.js#L18-L22

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/handlers/distance.js#L8

https://github.com/Raruto/leaflet-elevation/blob/bd9316bd1b7e7784b3bf3d812960eaa808ad94d6/src/handlers/distance.js#L17

👋 Raruto

HAmamiya commented 5 months ago

Thanks for the hints! So for aviation, the required options are:

speed: true,
speedLabel: 'knts',
xLabel: 'nm', //distanceLabel, will be ignored if imperial: true
distanceFactor: 0.539956803455724, //For km to nm. distanceFactor will be ignored if imperial: true
yLabel: 'ft',
altitude: true,
altitudeFactor: 3.281,
imperial: false,

And looks like the titled problem requires code fix and duplicated with https://github.com/Raruto/leaflet-elevation/issues/170, I shall mark this as closed as duplicate.