简体   繁体   中英

How does datamaps display images instead of bubbles?

I use the following code to display bubbles on datamaps. I want to show images instead of colored bubbles. How can I implement it?

 var bubs = [];             
 for (var ix in newsData) { 
   bubs.push({              
     name: newsData[ix].id, 
     latitude: newsData[ix].latitude,                       
     longitude: newsData[ix].longitude,                     
     radius: 18,            
     fillKey: 'gt50',       
     title: newsData[ix].title                              
   });                      
 };                         

 map.bubbles(bubs, {        
   popupTemplate: function(geo, data) {                     
     return "<div class='hoverinfo'><strong>" + geo.title + "</strong></div>";                                              
   }
});

I believe that this is not possible out of the box. But check out the datamaps-icons-plugin . Alternatively there is the datamaps-custom-marker plugin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM