Highcharts Demo

author(s): Torstein Hønsi

by Geo George

HTML

<script src="https://code.highcharts.com/maps/highmaps.js"></script>
<script src="https://code.highcharts.com/maps/modules/pattern-fill.js"></script>

<script src="https://code.highcharts.com/maps/modules/exporting.js"></script>
<script src="https://code.highcharts.com/mapdata/custom/world.js"></script>


<div id="container" style="max-width: 1000px"></div>

CSS

#container {
    height: 500px;
    min-width: 310px;
    max-width: 800px;
    margin: 0 auto;
}

.loading {
    margin-top: 10em;
    text-align: center;
    color: gray;
}

JavaScript

Highcharts.getJSON('https://cdn.jsdelivr.net/gh/highcharts/[email protected]/samples/data/world-population-density.json', function (data) {
  data=data.map(function(a){
   a["value"]=500;
  	return a;
  });
    // Initialize the chart
    Highcharts.mapChart('container', {

        title: {
            text: 'Grid line options'
        },

        mapNavigation: {
            enabled: true,
            buttonOptions: {
                verticalAlign: 'bottom'
            }
        },

        legend: {
            title: {
                text: 'Population density (/km²)'
            }
        },


        series: [{
            data: data,
            mapData: Highcharts.maps['custom/world'],
            joinBy: ['iso-a2', 'code'],
            name: 'Population density',
           // borderColor:"red",
            color: {
                pattern: {
     /*    path: {
                        d: 'M50 25L37.5 50 25 25 37.5 0zm-25 0L12.5 50 0 25 12.5 0z',			
                        strokeWidth:7
                    },
                    width:50,
                    height:50 */
                     //aspectRatio: 3 / 2,
                   // color:"red",
                    image:"https://artwork.wallartprints.com/media/catalog/category/cool-patterns_8bv6-bb.jpg", 
                    /* aspectRatio: 1
                    opacity: 1 */
                }
            }
 
        }]
    });
});