更改默认引脚的颜色 [英] Changing the color of a default pin
问题描述
有没有办法将默认针脚颜色从蓝色更改为橙色或绿色等任何其他颜色?我知道我可以放入自定义图像但是如果可以更改默认图钉的颜色是最好的。
谢谢
您是否有可能分享一些显示您身材的代码创建pin?
你可以看到HtmlMarkerOptions界面 https://docs.microsoft.com/en-us/javascript/api/azure-maps-control/atlas.htmlmarkeroptions?view=azure-iot -typescript-latest
a 这里有一个例子: https://github.com/Azure-Samples/AzureMap sCodeSamples / blob / master / AzureMapsCodeSamples / HTML%20Markers / Simple%20HTML%20Marker.html
var map;
函数GetMap(){
//初始化一个地图实例。
map = new atlas.Map('myMap',{
//将Azure Maps订阅密钥添加到地图SDK。//通过https获取Azure地图密钥: //azure.com/maps
authOptions:{
authType:'subscriptionKey',
subscriptionKey:'<你的Azure地图密钥>'
}
}) ;
//等到地图资源准备就绪。
map.events.add('ready',function(){
//创建一个HTML标记并将其添加到地图。
//在这里你可以自定义请阅读
// HtmlMarkerOptions接口doc我链接到
map.markers.add(new atlas.HtmlMarker({
color:'DodgerBlue',
text:'10',
position:[0,0]
}));
});
}
Is there way to change the default pin color from blue to any other color like orange or green? I know I can put in a custom image but if it's possible to change the color of the default pin that would be best.
Thanks
Is it possible for you to share some code that shows how you are creating the pin?
you can see HtmlMarkerOptions interface https://docs.microsoft.com/en-us/javascript/api/azure-maps-control/atlas.htmlmarkeroptions?view=azure-iot-typescript-latest
and there is an example here: https://github.com/Azure-Samples/AzureMapsCodeSamples/blob/master/AzureMapsCodeSamples/HTML%20Markers/Simple%20HTML%20Marker.html
var map; function GetMap() { //Initialize a map instance. map = new atlas.Map('myMap', { //Add your Azure Maps subscription key to the map SDK.
//Get an Azure Maps key at https://azure.com/maps authOptions: { authType: 'subscriptionKey', subscriptionKey: '<Your Azure Maps Key>' } }); //Wait until the map resources are ready. map.events.add('ready', function () { //Create a HTML marker and add it to the map. //Here you can customize please read the //HtmlMarkerOptions interface doc I linked to map.markers.add(new atlas.HtmlMarker({ color: 'DodgerBlue', text: '10', position: [0, 0] })); }); }
这篇关于更改默认引脚的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!