MrMufflon / Leaflet.Elevation

Leaflet plugin to view height profile of GeoJSON- and GPX polylines using d3
http://mrmufflon.github.io/Leaflet.Elevation
MIT License
276 stars 83 forks source link

Format Elevation at Tooltip #44

Closed dret closed 8 years ago

dret commented 8 years ago

when setting the elevation formatting to 2 decimals, this is taken into account for the graph, but not for the tooltip that is following the line. this still displays elevation in full resolution (which often is way too much). it would be great to apply he formatting function to the tooltip as well.

MrMufflon commented 8 years ago

Hi, if I set the hovernumber accordingly it formats both to two decimals hoverNumber: { decimalsX: 3, decimalsY: 2 },

Can you provide a sample?

dret commented 8 years ago

thanks for the feedback! this screen shot shows the problem, and here's the config i am using:

hoverNumber: {
  decimalsX: 2, 
  decimalsY: 0, 
  formatter: undefined 
}

i am not sure where the formatter is coming from, i guess i just copied this from somewhere. is it possible that the formatter is the problem?

MrMufflon commented 8 years ago

The "decimalsY" attribute is used for the height labels. So setting it to 2 should round your numbers as you wish. The formatter attribute can be deleted if you don´t specify a formatting function.

dret commented 8 years ago

it works for the graph tooltip, but not for the line tooltip, as you can see in the screen shot. i am not sure if that's a bug, or a missing feature.

MrMufflon commented 8 years ago

But your example states decimalsY=0 not 2. Or do you want to have no decimals at all?

dret commented 8 years ago

On 2016-03-03 11:17 , Felix Bache wrote:

But your example states decimalsY=0 not 2. Or do you want to have no decimals at all?

i am fine with how it shows up on the graph: two decimals for distance, none for elevation. what i was hoping for that it also would show up like this (no decimals, and not full precision as it is now) on the pointer on the line.

MrMufflon commented 8 years ago

With the latest version this works fine for me. screenshot from 2016-03-03 19-23-45

dret commented 8 years ago

On 2016-03-03 19:32 , Felix Bache wrote:

With the latest version this works fine for me.

i have to admit that i was using 0.0.2 so far. however, now i am trying to switch to 0.0.4, but when simply switching the JS and CSS files, things stop working completely. i don't even see my track anymore, let alone the elevation graph. i guess i have to spend some time to try to figure out how to upgrade from 0.0.2 to 0.0.4, or is there anything that comes to mind that could be a problem?

dret commented 8 years ago

figured out my upgrade issues and on this new screen shot, it indeed works. i should have looked at the version i am using. thanks for the feedback and help!

MrMufflon commented 8 years ago

Great to hear it works now!