diff --git a/src/partials/editor.html b/src/partials/editor.html index 2140e0b..33885ac 100644 --- a/src/partials/editor.html +++ b/src/partials/editor.html @@ -27,6 +27,10 @@
Map Visual Options
label="Sticky Labels" label-class="width-10" checked="ctrl.panel.stickyLabels" on-change="ctrl.toggleStickyLabels()"> +
+ + +
diff --git a/src/worldmap.js b/src/worldmap.js index a4611a2..74bde25 100644 --- a/src/worldmap.js +++ b/src/worldmap.js @@ -114,6 +114,7 @@ export default class WorldMap { location: dataPoint.key, }); circle.unbindPopup(); + this.createClickthrough(circle, dataPoint.key); this.createPopup(circle, dataPoint.locationName, dataPoint.valueRounded); } }); @@ -128,6 +129,7 @@ export default class WorldMap { location: dataPoint.key }); + this.createClickthrough(circle, dataPoint.key); this.createPopup(circle, dataPoint.locationName, dataPoint.valueRounded); return circle; } @@ -164,6 +166,15 @@ export default class WorldMap { } } + createClickthrough(circle, key) { + if (this.ctrl.panel.clickthroughURL) { + const newURL = this.ctrl.panel.clickthroughURL.replace('$country', key); + circle.on('click', function onClick(evt) { + window.location.assign(newURL); + }); + } + } + getColor(value) { for (let index = this.ctrl.data.thresholds.length; index > 0; index -= 1) { if (value >= this.ctrl.data.thresholds[index - 1]) { diff --git a/src/worldmap_ctrl.js b/src/worldmap_ctrl.js index c62b3a1..cca9edd 100644 --- a/src/worldmap_ctrl.js +++ b/src/worldmap_ctrl.js @@ -27,7 +27,8 @@ const panelDefaults = { decimals: 0, hideEmpty: false, hideZero: false, - stickyLabels: false + stickyLabels: false, + clickthroughURL: '' }; const mapCenters = {