Amcharts Map,如何默认缩放到亚洲大陆

时间:2017-09-10 14:53:17

标签: amcharts ammap

如何在页面加载时对亚洲大陆进行默认缩放。在Amcharts地图

1 个答案:

答案 0 :(得分:2)

您可以将地图dataProvider中的zoomLatitudezoomLongitudezoomLevel设置为您希望地图加载的默认位置和缩放级别。

以下示例:



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>
&#13;
&#13;
&#13;