-
Notifications
You must be signed in to change notification settings - Fork 0
/
bikes.js
125 lines (110 loc) · 3.18 KB
/
bikes.js
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
require([
"esri/arcgis/utils",
"dojo/domReady!"
], function(
arcgisUtils
) {
// create the map from the web map
arcgisUtils.createMap('4f14b86bae03448fac8e9ac8faff938f', 'map', {
mapOptions: {
zoom: 13
}
}).then(function(response) {
console.log(response)
// TODO: get this from the webmap
var esriBarSpec = {
"type": "chart",
"name": "test bar chart",
"title": "test bar chart",
"subTitle": "",
"footer": "",
"series": [
{
"type": "barSeries",
"title": "string",
"query": {
"where": "BICYCLE_ACCIDENT='Y' AND ACCIDENT_YEAR=2009",
"outStatistics": [{
"statisticType": "sum",
"onStatisticField": "COUNT_BICYCLIST_INJURED",
"outStatisticFieldName": "COUNT_BICYCLIST_INJURED_SUM"
},{
"statisticType": "sum",
"onStatisticField": "COUNT_BICYCLIST_KILLED",
"outStatisticFieldName": "COUNT_BICYCLIST_KILLED_SUM"
}],
"groupByFieldsForStatistics": "TIMECAT",
"orderByFields": "TIMECAT"
},
"x": "TIMECAT",
"y": "COUNT_BICYCLIST_INJURED_SUM",
"showLabels": false,
"horizontalAxisId": "x-axis",
"verticalAxisId": "y-axis",
"colorType": "singleColor",
"multipleBarType": "none",
"barSize": "long",
"fillSymbol": {
"type": "esriSFS",
"style": "esriSFSSolid",
"color": [255,0,0,255],
"outline": {
"type": "esriSLS",
"style": "esriSLSSolid",
"color": [110,110,110,255],
"width": 1
}
}
}
],
"legend": [
{
"type": "chartLegend",
"visible": false,
"title": "",
"alignment": "right",
"valueFormat": ""
}
],
"axes": [
{
"type": "chartAxis",
"id": "x-axis",
"visible": true,
"isLogarithmic": false,
"title": "Time of Day",
"valueFormat": "string",
"dateTimeFormat": "string",
"calculateAutomaticMinimum": true,
"calculateAutomaticMaximum": true,
"minimum": "number",
"maximum": "number"
},
{
"type": "chartAxis",
"id": "y-axis",
"visible": true,
"isLogarithmic": false,
"title": "Total Cyclists Injured",
"valueFormat": "string",
"dateTimeFormat": "string",
"calculateAutomaticMinimum": true,
"calculateAutomaticMaximum": true,
"minimum": "number",
"maximum": "number"
}
],
"metadata": "",
"dataSource": "http://services1.arcgis.com/tp9wqSVX1AitKgjd/ArcGIS/rest/services/roadsafegis_20092013/FeatureServer/0"
};
//create a show chart
var chart = new Cedar({
"type": "vg",
"spec": esriBarSpec
});
chart.show("#chart");
// set page title
document.title = response.itemInfo.item.title;
document.getElementById('pageTitle').innerHTML = response.itemInfo.item.title;
});
});