我想用谷歌地图图表显示动态图标
我做到了这一点
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是MarkerImage
”
这很完美,但此处显示的图标为ski
我想将此图标替换为另一个图标icon2
(使用MarkerImage
api创建)
知道怎么做吗?
答案 0 :(得分:0)
如果(!isNaN(number))var icon =“https://chart.googleapis.com/chart?chst=d_bubble_icon_text_small& chld = ski | bb | ”+ number +“| FFFFFF | 000000”;您需要更改API的网址。
并将“ski”替换为https://developers.google.com/chart/image/docs/gallery/dynamic_icons
中的另一个例如:chld = maps_pin 或chld =露营| ADDE63