JavaScript
// Prepare demo data
// Data is joined to map using value of 'hc-key' property by default.
// See API docs for 'joinBy' for more info on linking data and map.yo
var data = [
['us-ma', ''],
['us-wa', ''],
['us-ca', 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Flag_of_Sweden.svg/2000px-Flag_of_Sweden.svg.png', 300, 300],
['us-or', ''],
['us-wi', ''],
['us-me', ''],
['us-mi', ''],
['us-nv', ''],
['us-nm', ''],
['us-co', ''],
['us-wy', ''],
['us-ks', ''],
['us-ne', ''],
['us-ok', ''],
['us-mo', ''],
['us-il', ''],
['us-in', ''],
['us-vt', ''],
['us-ar', ''],
['us-tx', 'https://upload.wikimedia.org/wikipedia/commons/d/d9/Flag_of_Norway.svg', 270, 160],
['us-ri', ''],
['us-al', ''],
['us-ms', ''],
['us-nc', ''],
['us-va', ''],
['us-ia', ''],
['us-md', ''],
['us-de', ''],
['us-pa', ''],
['us-nj', ''],
['us-ny', ''],
['us-id', ''],
['us-sd', ''],
['us-ct', ''],
['us-nh', ''],
['us-ky', ''],
['us-oh', ''],
['us-tn', ''],
['us-wv', ''],
['us-dc', ''],
['us-la', ''],
['us-fl', ''],
['us-ga', ''],
['us-sc', ''],
['us-mn', ''],
['us-mt', ''],
['us-nd', ''],
['us-az', ''],
['us-ut', ''],
['us-hi', ''],
['us-ak', '']
];
// -----------------------------------------------------------------
// Add an image to the defs
Highcharts.Chart.prototype.addBackgroundImage = function(id, imageURL, width, height, offsetX, offsetY) {
var defs = this.renderTo.getElementsByTagName('defs')[0],
svgNS = 'http://www.w3.org/2000/svg',
pattern = document.createElementNS(svgNS, 'pattern'),
image = document.createElementNS(svgNS, 'image'),
imageWidth = width || 100,
imageHeight = height || 100;
pattern.setAttribute('id', id);
pattern.setAttribute('patternUnits', 'userSpaceOnUse');
pattern.setAttribute('width', imageWidth);
pattern.setAttribute('height', imageHeight);
image.setAttribute('href', imageURL);
image.setAttribute('x',...