Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions public/lib/vectormap_directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ module.directive('vectormap', function () {
render();
});

function isObjectEmpty(map) {
for(var key in map) {
if (map.hasOwnProperty(key)) {
return false;
}
}
return true;
}

function render() {
element.css({
height: element.parent().height(),
Expand All @@ -58,6 +67,9 @@ module.directive('vectormap', function () {
$('.jvectormap-zoomin, .jvectormap-zoomout, .jvectormap-label').remove();

require(['plugins/vectormap/lib/jvectormap/maps/map.' + scope.options.mapType], function () {
if(!scope.data || isObjectEmpty(scope.data)) {
return;
}
element.vectorMap({
map: scope.options.mapType,
regionStyle: { initial: { fill: '#8c8c8c' }},
Expand Down