[英]add marker to ammap map
我想向ammap地圖添加圓形標記。 標記應以柏林為中心,柏林的緯度為52.523407,經度為13.4114(您可以在此處驗證這些坐標)。
這是嘗試此操作的頁面的源代碼。 jsFiddle示例也是可用的 。
<html>
<head>
<script src="ammap.js" type="text/javascript"></script>
<script src="germanyLow.js" type="text/javascript"></script>
<script type="text/javascript">
var dataPoints = [{
latitude: 52.523407,
longitude: 13.4114,
type: 'bubble',
color: '#CC0000',
fixedSize: false,
alpha: 0.5,
height: 50,
width: 50
}];
AmCharts.ready(function() {
// create AmMap object
var map = new AmCharts.AmMap();
// set path to images
map.pathToImages = "images/map";
var dataProvider = {
mapVar: AmCharts.maps.germanyLow,
getAreasFromMap:true,
images: dataPoints
};
// pass data provider to the map object
map.dataProvider = dataProvider;
map.areasSettings = {
autoZoom: true,
selectedColor: "#CC0000"
};
// write the map to container div
map.write("mapdiv");
});
</script>
</head>
<body>
<div id="mapdiv" style="width: 600px; height: 400px;"></div>
</body>
</html>
如果打開此頁面,則會看到以下內容。 我自己添加了黑色箭頭,以指示圓圈應位於的位置。 如您所見,圓的中心應位於其西北約150公里處。 如果添加其他標記,它們還將位於西北距我期望的位置約150公里處。 我是在做錯什么,還是一個錯誤?
您應該在MapImage中添加“ centered:false”屬性:
var dataPoints = [{
latitude: 52.523407,
longitude: 13.4114,
type: 'bubble',
color: '#CC0000',
fixedSize: false,
alpha: 0.5,
height: 50,
width: 50,
centered: false
}];
這是您更新的小提琴:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.