Reputation: 109
I'm trying to use jvectormap in a grails application and have been following the examples on the jvectormap website to get started. However, I cannot figure out why I'm getting the error that "jvm.Map is not a constructor". I included all the necessary .css and .js files, and the code is pretty much verbatim from jvectormap's website.
<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="main">
<asset:stylesheet src="jquery-jvectormap-2.0.1.css"/>
<asset:javascript src="jquery-jvectormap-2.0.1.min.js"/>
<asset:javascript src="jquery-jvectormap-world-mill-en.js"/>
</head>
<body>
<div id="widthholder"><span></span></div>
<div id="world-map" style="width: 600px; height: 400px"></div>
<script>
var gdpData = {
"AF": 16.63,
"AL": 11.58,
"DZ": 158.97
};
$(function(){
map = new jvm.Map({
map: 'world_mill_en',
container: $('#world-map'),
series: {
regions: [{
values: gdpData,
scale: ['#C8EEFF', '#0071A4'],
normalizeFunction: 'polynomial'
}]
},
onRegionTipShow: function(e, el, code){
el.html(el.html()+' (GDP - '+gdpData[code]+')');
}
});
});
</script>
</body>
</html>
Upvotes: 3
Views: 1644
Reputation: 31
Answer is here http://jvectormap.com/tutorials/data-visualization/
var mapObject = $('.map').vectorMap('get', 'mapObject');
Upvotes: 2