Reputation: 25
How can i access the Datamap object properties?? I tried to print the map.scope but i got undefined. Can anyone please do let me know how can i access the the map object property??
<!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>
Upvotes: 0
Views: 284
Reputation: 1451
replace
console.log(map.scope);
with
console.log(map.options.scope);
Upvotes: 0