mirror of
https://github.com/hanzoai/jube-fork.git
synced 2026-11-02 14:29:36 +00:00
133 lines
4.4 KiB
HTML
Executable File
133 lines
4.4 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Bubble layer</title>
|
|
<meta charset="utf-8">
|
|
<link href="../content/shared/styles/examples-offline.css" rel="stylesheet">
|
|
<link href="../../styles/kendo.common.min.css" rel="stylesheet">
|
|
<link href="../../styles/kendo.rtl.min.css" rel="stylesheet">
|
|
<link href="../../styles/kendo.default.min.css" rel="stylesheet">
|
|
<link href="../../styles/kendo.default.mobile.min.css" rel="stylesheet">
|
|
<script src="../../js/jquery.min.js"></script>
|
|
<script src="../../js/jszip.min.js"></script>
|
|
<script src="../../js/kendo.all.min.js"></script>
|
|
<script src="../content/shared/js/console.js"></script>
|
|
<script>
|
|
|
|
</script>
|
|
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<a class="offline-button" href="../index.html">Back</a>
|
|
|
|
<div id="example">
|
|
<div class="configurator">
|
|
<div class="header">Configurator</div>
|
|
<div class="box-col layer-group">
|
|
<h4>Bubble symbol</h4>
|
|
<div id="select-symbol">
|
|
<span>Circle</span>
|
|
<span>Square</span>
|
|
</div>
|
|
</div>
|
|
<div id="info" class="box-col"></div>
|
|
</div>
|
|
|
|
<div id="map"></div>
|
|
|
|
<script id="info-template" type="text/x-kendo-template">
|
|
<h4>#: City #, #= Country #</h4>
|
|
<p class="info">Population #= kendo.toString(Pop2010 * 1000, "N0") #</p>
|
|
</script>
|
|
<script id="empty-info-template" type="text/x-kendo-template">
|
|
<h4>Hover over urban areas</h4>
|
|
<p> </p>
|
|
</script>
|
|
<script>
|
|
function createMap() {
|
|
var template = kendo.template($("#info-template").html());
|
|
var emptyTemplate = kendo.template($("#empty-info-template").html());
|
|
var activeShape;
|
|
|
|
$("#map").kendoMap({
|
|
center: [45, 45],
|
|
minZoom: 3,
|
|
zoom: 4,
|
|
wraparound: false,
|
|
layers: [{
|
|
type: "tile",
|
|
urlTemplate: "https://#= subdomain #.tile.openstreetmap.org/#= zoom #/#= x #/#= y #.png",
|
|
subdomains: ["a", "b", "c"],
|
|
attribution: "© <a href='https://osm.org/copyright'>OpenStreetMap contributors</a>"
|
|
}, {
|
|
type: "bubble",
|
|
attribution: "Population data from Nordpil and UN Population Division.",
|
|
style: {
|
|
fill: {
|
|
color: "#00f",
|
|
opacity: 0.4
|
|
},
|
|
stroke: {
|
|
width: 0
|
|
}
|
|
},
|
|
dataSource: {
|
|
transport: {
|
|
read: {
|
|
url: "../content/dataviz/map/urban-areas.json",
|
|
dataType: "json"
|
|
}
|
|
}
|
|
},
|
|
locationField: "Location",
|
|
valueField: "Pop2010"
|
|
}],
|
|
shapeMouseEnter: onShapeMouseEnter,
|
|
reset: onReset
|
|
});
|
|
|
|
function onShapeMouseEnter(e) {
|
|
if (activeShape) {
|
|
activeShape.options.set("stroke", null);
|
|
}
|
|
|
|
activeShape = e.shape;
|
|
activeShape.options.set("stroke", { width: 1.5, color: "#00f" });
|
|
|
|
$("#info").html(template(e.shape.dataItem));
|
|
}
|
|
|
|
function onReset() {
|
|
$("#info").html(emptyTemplate({}));
|
|
activeShape = null;
|
|
}
|
|
|
|
$("#select-symbol").kendoButtonGroup({
|
|
select: function (e) {
|
|
var layer = $("#map").data("kendoMap").layers[1];
|
|
layer.options.symbol = this.current().index() === 0 ? "circle" : "square";
|
|
layer.reset();
|
|
},
|
|
index: 0
|
|
});
|
|
}
|
|
|
|
$(document).ready(createMap);
|
|
</script>
|
|
</div>
|
|
|
|
|
|
|
|
<div class='demo-section'>
|
|
<h3>Note:</h3>
|
|
<p>
|
|
Security restrictions prevent this example from working in all browsers when the page is loaded from the file system (via file:// protocol).
|
|
If the demo is not working as expected, please host the Kendo folder on a web server.
|
|
</p>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|