0

如何访问 Datamap 对象属性?我试图打印 map.scope 但我没有定义。谁能告诉我如何访问地图对象属性?

<!DOCTYPE html>
<html>
<head>
  <title>
  </title>
</head>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
  <script src="http://d3js.org/topojson.v1.min.js"></script>
  <script src="http://datamaps.github.io/scripts/datamaps.world.min.js?v=1"></script>
  <div id="container" style="width: 400px; height: 400px;"></div>
<script>
    var map = new Datamap({
        scope: 'world',
        element: document.getElementById("container"),
        projection: 'mercator',
        fills: {
          defaultFill: '#f0af0a',
          lt50: 'rgba(0,244,244,0.9)',
          gt50: 'red'
        },

    data: {
      USA: {fillKey: 'lt50' },
    }
      });
    console.log(map.scope);
</script>
</body>
</html>
4

1 回答 1

0

代替

console.log(map.scope);

console.log(map.options.scope);
于 2020-02-01T22:31:22.487 回答