-
Notifications
You must be signed in to change notification settings - Fork 0
/
badasscoffee.html
76 lines (70 loc) · 3.28 KB
/
badasscoffee.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Geoenrichment - InfographicsCarousel</title>
<link rel="stylesheet" href="//js.arcgis.com/3.13/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="//js.arcgis.com/3.13/esri/dijit/geoenrichment/themes/common/main.css">
<link rel="stylesheet" href="//js.arcgis.com/3.13/esri/css/esri.css">
<style>
html, body, #map {
height: 100%;
margin: 0;
}
#infographics {
position: absolute;
top: 10px;
right: 10px;
}
</style>
<script src="//js.arcgis.com/3.13/"></script>
<script>
require([
"esri/map", "esri/urlUtils", "esri/graphic", "esri/dijit/geoenrichment/InfographicsCarousel", "esri/dijit/geoenrichment/InfographicsOptions", "esri/tasks/geoenrichment/DriveBuffer",
"esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleFillSymbol", "esri/tasks/geoenrichment/GeometryStudyArea", "dojo/domReady!"
], function(Map, urlUtils, Graphic, InfographicsCarousel, InfographicsOptions, DriveBuffer, SimpleMarkerSymbol, SimpleFillSymbol, GeometryStudyArea){
var map = new Map("map", {
basemap: "topo",
center: [-105.255, 40.022],
zoom: 5
});
var infographicsCarousel = new InfographicsCarousel({
returnGeometry: true
}, "infographics");
dijit.byId("infographics").domNode.style.display = "none"; //hide the infographicsCarousel until first click
var options = new InfographicsOptions();
options.studyAreaOptions = new DriveBuffer({ radius: 5 });
options.getItems("US").then(function(items){
for (var i = 0; i < items.length; i++) {
items[i].isVisible = false; //make all default infographics invisible
}
var item0 = new InfographicsOptions.Item("OneVar", ["shopping.MP08006a_B.*"]);
var item1 = new InfographicsOptions.Item("OneVar", ["Wealth.PCI_CY"]);
var item2 = new InfographicsOptions.Item("AgePyramid", ["Age.*"]);
items.push(item0, item1, item2); //add two new items to the infographicsCarousel
infographicsCarousel.set("options", options);
});
var studyAreaGraphic;
map.on("click", function(evt){
map.graphics.clear(); //clear existing graphics on map
studyAreaGraphic = undefined; //set studyAreaGraphic as undefined
map.graphics.add(new Graphic(evt.mapPoint, new SimpleMarkerSymbol()));
dijit.byId("infographics").domNode.style.display = "inline-block"; //show the infographicsCarousel
infographicsCarousel.set("studyArea", new GeometryStudyArea({ geometry: evt.mapPoint }));
infographicsCarousel.startup();
});
infographicsCarousel.on("data-ready", function(evt){
if (!studyAreaGraphic) {
studyAreaGraphic = new Graphic(evt.provider.getGeometry(), new SimpleFillSymbol());
map.graphics.add(studyAreaGraphic);
}
});
});
</script>
</head>
<body class="claro">
<div id="map"></div>
<div id="infographics"></div>
</body>
</html>