How to add a European map to your Blog Post

The below video will show you a quick and easy way to add an interactive European map to your blog post. In this example, I used publicly available data from the Nato.int website to build a map of North Atlantic Treaty Organization (NATO) Defense Expenditures by NATO member country. Remember, you do not have to understand how the code works to use it on your blog.

Interactive Map and Code Snippet

NATO Defense Expenditures by Member Country


<code>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
      google.charts.load('current', {'packages':['geochart']});
      google.charts.setOnLoadCallback(drawRegionsMap);
      function drawRegionsMap() 
      {
        var data = google.visualization.arrayToDataTable([
        ['Country', 'Expenditures'],
        ['Albania',1.207],
        ['Belgium',0.854],
        ['Bulgaria',1.346],
        ['Croatia',1.229],
        ['Czech Republic',1.035],
        ['Denmark',1.173],
        ['Estonia',2.164],
        ['France',1.782],
        ['Germany',1.191],
        ['Greece',2.384],
        ['Hungary',1.008],
        ['Italy',1.113],
        ['Latvia',1.454],
        ['Lithuania',1.493],
        ['Luxembourg',0.44],
        ['Netherlands',1.168],
        ['Norway',1.535],
        ['Poland',1.997],
        ['Portugal',1.383],
        ['Romania',1.481],
        ['Slovak Republic',1.159],
        ['Slovenia',0.936],
        ['Spain',0.905],
        ['Turkey',1.558],
        ['United Kingdom',2.209],
	]);
		var options = {
        region: '150', // Europe
        colorAxis: {colors: ['#F90909', '#F1F909']},
        datalessRegionColor: '#ffffff',
        defaultColor: '#000000',
        mapType: 'styledMap',
        zoomLevel: 15,
        };	
        var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));
        chart.draw(data, options);
      }
</script>
<div id="regions_div" style="width: 900px; height: 500px;"></div>
</code>

1928.us

Subscribe now and we will let you know when we post something cool!

Powered by ConvertKit