Raruto / leaflet-elevation

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

`distance: false` not showing none of the other chart profiles #194

Closed hupe13 closed 2 years ago

hupe13 commented 2 years ago

Hi Raruto,

you wrote in the Readme:

// Display distance info: true || "summary" || false

If I set distance to false, none of the chart profiles is displayed, even if I load the handlers with "import".

Your environment

Steps to reproduce

handlers: [
    import(".../leaflet-elevation-2.2.4/src/handlers/altitude.js"),
    import(".../leaflet-elevation-2.2.4/src/handlers/distance.js"),
    import(".../leaflet-elevation-2.2.4/src/handlers/time.js"),
],
altitude: true,
detached: true,
distance: false,

Expected behaviour

A chart profile should be displayed.

Actual behaviour

No chart profile is displayed.

The same effect occurs if you set distance to false in your file examples/leaflet-elevation.html. What is wrong?

Thank you very much.

Raruto commented 2 years ago

Hi hupe, please when you create a new issue always try to add some pictures or demos that can show everyone pretty quickly what you mean (it takes a long time to force everyone to recreate your environment), anyway:

distance: false,

A chart profile should be displayed.

I think we are in a fairly extreme case here, but exactly what would you recommend to do? (keep in mind that at the implementation level all profiles share practically the same options, perhaps this one in particular was not only documented before).

Have a nice day, Raruto

hupe13 commented 2 years ago

I modified your example and set distance to false. As you can see, no length information appears in the summary and also not on the x axis. That is correct. But the chart does not appear either. That is not correct. I don't know if anyone would want to display a chart without length specifications, but maybe they would? I suggest either to adapt the readme or to find a solution to display the chart.

// Display distance info: true || "summary" || false

hupe13

Raruto commented 2 years ago

@hupe13 I haven't done extensive testing, but it should be a good starting point: https://github.com/Raruto/leaflet-elevation/pull/199

Let me know, Raruto

hupe13 commented 2 years ago

My tests are working right. Thank you very much.