双击amCharts时删除缩放?

时间:2017-05-11 04:43:30

标签: javascript html amcharts

我正在使用amCharts - 地图。

如何在amCharts中双击地图上的主页图标时删除缩放?

HTML:

<head>
  <title>jVectorMap demo</title>
  <script src="ammap/ammap.js" type="text/javascript"></script>
  <link rel="stylesheet" href="ammap/ammap.css" type="text/css" media="all" />
  <script src="ammap/maps/js/japanHigh.js" type="text/javascript"></script>
  <script src="js/map.js"></script>
</head>

<body>
  <div id="mapdiv" style="width: 1350px; height: 550px;"></div>
</body>

使用Javascript:

let map = AmCharts.makeChart("mapdiv", {
  "type": "map",
  "dragMap": false,
  /* can't drag the maparound now*/

  "dataProvider": {
    "map": "japanHigh",
    "getAreasFromMap": true
  },

  "areasSettings": {
    // "autoZoom": false,
    "selectedColor": "#CC0000"
  },

  "zoomControl": {
    "zoomControlEnabled": false,
    /*removing the zoomin and out button from top left corner */
    // "maxZoomLevel": 0
    // "zoomFactor":false
  }
});

1 个答案:

答案 0 :(得分:3)

要在双击ammap时删除缩放效果,您可以将zoomOnDoubleClick定义为false。要删除主页图标,您可以将homeButtonEnabled定义为false

对于您的代码,它将是:

let map = AmCharts.makeChart( "mapdiv", {
  "type": "map",
  "dragMap": false,     /* can't drag the maparound now*/
  "zoomOnDoubleClick": false,

  "dataProvider": {
    "map": "japanHigh",
    "getAreasFromMap": true
  },

  "areasSettings": {
    // "autoZoom": false,
    "selectedColor": "#CC0000"
  },

  "zoomControl": {
    "zoomControlEnabled": false,      /*removing the zoomin and out button from top left corner */
    "homeButtonEnabled": false
    // "maxZoomLevel": 0
    // "zoomFactor":false
  }
});