Raruto / leaflet-elevation

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

Append custom labels inside chart tooltip #168

Closed velocat closed 2 years ago

velocat commented 2 years ago

Hello Raruto. I haven't asked questions for a long time, but now I have a couple of questions:

  1. How to add labels for height and distance values? For others, I could, but got confused about it. It begs to make an option: "display labels" :) ele-labels

  2. I really liked the timeline, but my users would like to see this data also in a pop-up window on mouse hover, and not just as a timeline. Can you tell me where to look for me to implement this?

Raruto commented 2 years ago

Hi velocat,

  1. How to add labels for height and distance values? For others, I could, but got confused about it. It begs to make an option: "display labels" :)

Please also show me the code you already use to prepend those other labels.

  1. I really liked the timeline, but my users would like to see this data also in a pop-up window on mouse hover, and not just as a timeline. Can you tell me where to look for me to implement this?

This should be the code responsible for adding the timeline axis (time duration):

https://github.com/Raruto/leaflet-elevation/blob/ac803fd023718e097a71f5121501a6a5043946d2/src/time.js#L38-L62

and this the code responsible for adding the single timestamp entry inside the chart tooltip:

https://github.com/Raruto/leaflet-elevation/blob/ac803fd023718e097a71f5121501a6a5043946d2/src/time.js#L105-L108

Feel free to submit a proposal pull request if you will be able to produce some useful code for others.

Have a nice day, Raruto

velocat commented 2 years ago

Create Pull: https://github.com/Raruto/leaflet-elevation/pull/169 :smiley: