-
-
Save gist-master/d4582c2f8d34c57358e111cacd2f9157 to your computer and use it in GitHub Desktop.
Map: bubble layer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="aurelia-kendoui-bridge/map/map"></require> | |
<div id="example"> | |
<div class="box wide"> | |
<div class="box-col"> | |
<h4>Bubble symbol</h4> | |
<ul ref="selectSymbol"> | |
<li>Circle</li> | |
<li>Square</li> | |
</ul> | |
</div> | |
<div ref="info" class="box-col"></div> | |
</div> | |
<div id="map-bubble-layer"> | |
<div style="text-align: center"> | |
<ak-map k-center.bind = "center" | |
k-zoom.bind = "4" | |
k-min-zoom.bind = "3" | |
k-wraparound.bind = "false" | |
k-layers.bind = "layers" | |
k-widget.two-way = "map" | |
k-on-shape-mouse-enter.delegate="onShapeMouseEnter($event.detail)" | |
k-on-reset.delegate="onReset()"> | |
</ak-map> | |
</div> | |
</div> | |
</div> | |
<script ref="infoTemplate" type="text/x-kendo-template"> | |
<h4>#: City #, #= Country #</h4> | |
<p class="info">Population #= kendo.toString(Pop2010 * 1000, "N0") #</p> | |
</script> | |
<script ref="emptyInfoTemplate" type="text/x-kendo-template"> | |
<h4>Hover over urban areas</h4> | |
<p> </p> | |
</script> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class BubbleLayer { | |
center = [45, 45]; | |
layers = [{ | |
type: 'tile', | |
urlTemplate: 'http://otile3.mqcdn.com/tiles/1.0.0/sat/#= zoom #/#= x #/#= y #.png', | |
attribution: 'Tiles © <a href=\'http://www.mapquest.com/\' target=\'_blank\'>MapQuest</a>' | |
}, { | |
type: 'bubble', | |
attribution: 'Population data from Nordpil and UN Population Division.', | |
style: { | |
fill: { | |
color: '#fff', | |
opacity: 0.4 | |
}, | |
stroke: { | |
width: 0 | |
} | |
}, | |
dataSource: new kendo.data.DataSource({ | |
transport: { | |
read: function(options) { | |
return System.import('samples/map/json/urban-areas.json!json') | |
.then(data => options.success(data)); | |
} | |
} | |
}), | |
locationField: 'Location', | |
valueField: 'Pop2010' | |
}]; | |
attached() { | |
$(this.selectSymbol).kendoMobileButtonGroup({ | |
select: (e) => { | |
let layer = this.map.layers[1]; | |
layer.options.symbol = e.index === 0 ? 'circle' : 'square'; | |
layer.reset(); | |
}, | |
index: 0 | |
}); | |
} | |
onReset() { | |
this.info.innerHTML = kendo.template(this.emptyInfoTemplate.innerHTML)({}); | |
this.activeShape = null; | |
} | |
onShapeMouseEnter(e) { | |
if (this.activeShape) { | |
this.activeShape.options.set('stroke', null); | |
} | |
this.activeShape = e.shape; | |
this.activeShape.options.set('stroke', { width: 1.5, color: '#fff' }); | |
this.info.innerHTML = kendo.template(this.infoTemplate.innerHTML)(e.shape.dataItem); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Aurelia KendoUI bridge</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.2.714/styles/kendo.common.min.css"> | |
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.2.714/styles/kendo.rtl.min.css"> | |
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.2.714/styles/kendo.default.min.css"> | |
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/2016.2.714/styles/kendo.mobile.all.min.css"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.4.0/bluebird.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/chroma-js/1.2.1/chroma.min.js"></script> | |
<script src="https://kendo.cdn.telerik.com/2016.2.714/js/jquery.min.js"></script> | |
<script src="https://kendo.cdn.telerik.com/2016.2.714/js/jszip.min.js"></script> | |
<script src="https://kendo.cdn.telerik.com/2016.2.714/js/kendo.all.min.js"></script> | |
</head> | |
<body aurelia-app="main"> | |
<h1>Loading...</h1> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.6/system.js"></script> | |
<script src="https://rawgit.com/aurelia-ui-toolkits/aurelia-kendoui-bundles/1.0.0-beta.1.0.6/config2.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function configure(aurelia) { | |
aurelia.use | |
.standardConfiguration() | |
.developmentLogging() | |
.plugin('aurelia-kendoui-bridge'); | |
aurelia.start().then(a => a.setRoot()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment