Amcharts 地图,如何默认缩放到亚洲大陆
Amcharts Map, how to make default zoom to Asia continent
如何在页面加载时默认缩放到亚洲大陆。在 Amcharts 地图中
您可以将地图 dataProvider
中的 zoomLatitude
, zoomLongitude
and zoomLevel
设置为您希望加载地图的默认位置和缩放级别。
示例如下:
var map = AmCharts.makeChart("chartdiv", {
"type": "map",
"theme": "light",
"dataProvider": {
"map": "continentsLow",
"zoomLatitude": 47.8936,
"zoomLongitude": 115.6176,
"zoomLevel": 2,
"getAreasFromMap": true,
"areas": [{
"id": "asia",
"showAsSelected": true
}]
},
"areasSettings": {
"autoZoom": false,
"selectedColor": "#CC0000"
}
});
<script src="https://www.amcharts.com/lib/3/ammap.js"></script>
<script src="https://www.amcharts.com/lib/3/maps/js/continentsLow.js"></script>
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
<div id="chartdiv" style="width:100%; height: 250px"></div>
如何在页面加载时默认缩放到亚洲大陆。在 Amcharts 地图中
您可以将地图 dataProvider
中的 zoomLatitude
, zoomLongitude
and zoomLevel
设置为您希望加载地图的默认位置和缩放级别。
示例如下:
var map = AmCharts.makeChart("chartdiv", {
"type": "map",
"theme": "light",
"dataProvider": {
"map": "continentsLow",
"zoomLatitude": 47.8936,
"zoomLongitude": 115.6176,
"zoomLevel": 2,
"getAreasFromMap": true,
"areas": [{
"id": "asia",
"showAsSelected": true
}]
},
"areasSettings": {
"autoZoom": false,
"selectedColor": "#CC0000"
}
});
<script src="https://www.amcharts.com/lib/3/ammap.js"></script>
<script src="https://www.amcharts.com/lib/3/maps/js/continentsLow.js"></script>
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
<div id="chartdiv" style="width:100%; height: 250px"></div>