-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
49 lines (42 loc) · 1.26 KB
/
test.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
<html>
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script type="text/javascript" src="https://vega.github.io/vega/vega.min.js"></script>
<script type="text/javascript" src="https://npmcdn.com/arcgis-cedar/dist/cedar.js"></script>
</head>
<body>
<div class="row">
<div style="width: 300px; height: 300px" id="chart"></div>
</div>
<script>
var chart = new Cedar({"type": "bar"});
//create the dataset w/ mappings
var dataset = {
"url":"https://services.arcgis.com/uDTUpUPbk8X8mXwl/arcgis/rest/services/Public_Schools_in_Onondaga_County/FeatureServer/0",
"query": {
"groupByFieldsForStatistics": "Type",
"outStatistics": [{
"statisticType": "sum",
"onStatisticField": "Number_of",
"outStatisticFieldName": "Number_of_SUM"
}]
},
"mappings":{
"sort": "Number_of_SUM DESC",
"x": {"field":"Type","label":"Facility Use"},
"y": {"field":"Number_of_SUM","label":"Total Students"}
}
};
chart.tooltip = {
"title": "{Type}",
"content": "{Number_of_SUM} Students in {Type}"
}
//assign to the chart
chart.dataset = dataset;
//show the chart
chart.show({
elementId: "#chart"
});
</script>
</body>
</html>