简体   繁体   中英

How to use dynamic icon with google map chart

I want to display a dynamic icon with google map chart

I had done this far

function putMaker(position,title,title_dis,number,icon_img,icon2)
{


     if (!isNaN(number)) var icon = "https://chart.googleapis.com/chart?chst=d_bubble_icon_text_small&chld=ski|bb|"+number+"|FFFFFF|000000";


    else var icon = null;
    //icon= icon2;
     var marker = new google.maps.Marker({
                      position: position,
                      map: map,
                      icon: icon,

                     });
     google.maps.event.addListener(marker, 'mouseover', function() {
                   infowindow.setContent(title_dis);
                   infowindow.open(map, this);
                   });
}

"icon2 is a MarkerImage "

This is perfect but the icon shown here is ski 在此处输入图片说明

I want to replace this icon with another icon say icon2 (created using MarkerImage api) Any idea how to do this ?

you need to change url of API if (!isNaN(number)) var icon = " https://chart.googleapis.com/chart?chst=d_bubble_icon_text_small& chld=ski|bb| "+number+"|FFFFFF|000000";

and replace "ski" to another from https://developers.google.com/chart/image/docs/gallery/dynamic_icons

eg: chld=maps_pin or chld=camping|ADDE63

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