MrMufflon / Leaflet.Elevation

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

Display chart into popup #7

Open antlo opened 11 years ago

antlo commented 11 years ago

Hi,

Thank you first for this usefull plugin.

I'd like to display the chart into a popup. I don't know if there is a method to do this. I'm trying with my code but with no success yet.

Thank you in advance for some help.

MrMufflon commented 11 years ago

Hi, thanks! :)

You can try to create a new instance with var el = L.control.elevation(). Then try to call el.onAdd(YOUR_MAP_INSTANCE) which returns the container the chart resides in. If this works let me know, maybe I find some time to create a cleaner solution..

Regards Felix

GeoTimber commented 10 years ago

Hi Felix and Antio, Yes this works well...

In your geojson example I tested it:

...
<div id="map"></div>
<div id="elevation-div" class="leaflet-control elevation"></div>
...
<script type="text/javascript">
...
var el = L.control.elevation();

el.addTo(map);

var container=el.onAdd(map);
document.getElementById('elevation-div').appendChild(container);
...
</script>

And now the div is below the map.

Thanks for the great control! I like it. Good work, best Joris

buchanan-fh commented 8 years ago

Did somebody succeed to put the chart inside a popup ? I tried the way suggested above (get the container and then appendChild to a div that is already inside my popup), but then I get troubles with the way the mouse acts when you move it over the chart: