如何在标记上显示图表

时间:2017-04-19 11:55:51

标签: javascript jquery html css leaflet

如何在点击标记时显示canvas.js图表​​,以便图表应显示在同一页面底部的模式框中。 我的代码是:

var map = L.map( 'map', {
    center: [27.0238,74.2179],
    minZoom: 6,
    zoom: 2
});
L.tileLayer( 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
    subdomains: ['a','b','c']
}).addTo( map );



var myURL = jQuery( 'script[src$="leaf-demo.js"]' ).attr( 'src' ).replace( 'leaf-demo.js', '' );
 var mywms = L.tileLayer.wms("http://localhost:8880/geoserver/march_demo/wms", {
    layers: 'march_demo:dist_reproject',
    format: 'image/png',
    transparent: true,
    version: '1.1.0',
    attribution: "myattribution"
});
mywms.addTo(map);
var myIcon = L.icon({
    iconUrl: myURL + 'images/mark.png',
    iconSize: [24, 22],
    iconAnchor: [9, 21],
    popupAnchor: [0, -14]
});

for ( var i=0; i < markers.length; i++ ) 
{
   L.marker( [markers[i].lat, markers[i].lng], {icon: myIcon} )
      .bindPopup( '<a href="' + markers[i].url + '" target="_blank">' + markers[i].name + '</a>' )
      .addTo( map );
}

https://jsfiddle.net/anushri21/hoja92nn/

0 个答案:

没有答案