-
Notifications
You must be signed in to change notification settings - Fork 0
/
hold.js
239 lines (196 loc) · 6.41 KB
/
hold.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
am4core.ready(function() {
/* am4core.useTheme(am4themes_animated);
*/
let chart = am4core.create("chartdiv", am4charts.XYChart);
chart.padding(0, 0, 0, 0);
let title = chart.tooltipContainer.createChild(am4core.Label);
/* title.text = "TransLink"; */
title.fill = am4core.color("#00254b");
title.fontSize = 25;
title.width = am4core.percent(100);
title.textAlign = "middle";
title.x = 10;
title.y = 10;
function createAxis(list) {
let axis = list.push(new am4charts.ValueAxis());
axis.min = 0;
axis.max = 100;
axis.strictMinMax = true;
axis.renderer.grid.template.disabled = true;
axis.renderer.labels.template.disabled = true;
axis.renderer.baseGrid.disabled = true;
}
createAxis(chart.xAxes);
createAxis(chart.yAxes);
function createLine(name, color, data) {
let series = chart.series.push(new am4charts.LineSeries());
series.data = data;
series.name = name;
series.dataFields.valueX = "x";
series.dataFields.valueY = "y";
series.stroke = color;
series.strokeWidth = 0;
series.connect = false;
series.propertyFields.strokeDasharray = "dash";
let bullet = series.bullets.push(new am4charts.CircleBullet());
bullet.circle.radius = 1 //4;
bullet.circle.fill = am4core.color("#fff");
bullet.circle.stroke = am4core.color("#000");
bullet.circle.strokeWidth = 2;
bullet.circle.tooltipText = "{station}";
}
/* function createStepLine(name, color, data) {
let series = chart.series.push(new am4charts.StepLineSeries());
series.data = data;
series.name = name;
series.dataFields.valueX = "x";
series.dataFields.valueY = "y";
series.stroke = color;
series.strokeWidth = 6;
series.connect = false;
series.propertyFields.strokeDasharray = "dash";
let bullet = series.bullets.push(new am4charts.CircleBullet());
bullet.circle.radius = 1 //4;
bullet.circle.fill = am4core.color("#fff");
bullet.circle.stroke = am4core.color("#000");
bullet.circle.strokeWidth = 2;
bullet.circle.tooltipText = "{station}";
} */
/* function createLineBreak(name, color, data) {
let series = chart.series.push(new am4charts.LineSeries());
series.data = data;
series.name = name;
series.dataFields.valueX = "x";
series.dataFields.valueY = "y";
series.stroke = color;
series.strokeWidth = 6;
series.connect = false;
series.propertyFields.strokeDasharray = "dash";
/*
let bullet = series.bullets.push(new am4charts.CircleBullet());
bullet.circle.radius = 2;
bullet.circle.fill = am4core.color("#fff");
bullet.circle.stroke = am4core.color("#000");
bullet.circle.strokeWidth = 2;
bullet.circle.tooltipText = "{station}";
*/
}
*/
/* function createStepLine(name, color, data) {
let series = chart.series.push(new am4charts.StepLineSeries());
series.data = data;
series.name = name;
series.dataFields.valueX = "x";
series.dataFields.valueY = "y";
series.stroke = color;
series.strokeWidth = 6;
series.connect = false;
series.propertyFields.strokeDasharray = "dash";
let bullet = series.bullets.push(new am4charts.CircleBullet());
bullet.circle.radius = 4;
bullet.circle.fill = am4core.color("#fff");
bullet.circle.stroke = am4core.color("#000");
bullet.circle.strokeWidth = 2;
bullet.circle.tooltipText = "{station}";
} */
function createIconPin(/* mode */ data) {
let series = chart.series.push(new am4charts.LineSeries());
series.data = data;
series.dataFields.valueX = "x";
series.dataFields.valueY = "y";
series.stroke = am4core.color("#1c59ae");
series.strokeWidth = 1;
series.connect = false;
series.propertyFields.strokeDasharray = "dash";
let icon = series.bullets.push(new am4plugins_bullets.PinBullet());
icon.locationX = 1;
icon.stroke = am4core.color("#fff");
icon.background.fill = am4core.color("#1c59ae");
icon.background.radius=10
icon.background.pointerBaseWidth=10
icon.background.pointerLength=10
icon.background.propertyFields.pointerAngle='angle'
icon.image = new am4core.Image();
icon.image.propertyFields.href = 'icon'
icon.image.scale = .7;
icon.circle.radius = am4core.percent(100);
}
/* if(mode === 'y'){
icon.dy = -5
} else if(mode === 'x'){
icon.dx = - 5
} */
/*
lineConstructor('x')
lineConstructor('y') */
/* createConnector([
{ x: 33.8, y: 63.83},
{ x: 32.4, y: 61.8 }]
); */
createIconPin([
{ icon: 'seaBus1.png', angle: 45, offset: 'x', station: 'Vancouver City Centre', x: 19, y: 78.5},
{},
{ icon: 'seaBus1.png', angle: 45, station: 'Park Royal', x: 13.7, y: 95.3 },
{},
{ icon: 'plane.png', angle: 45, station:'YVR Airport' , x: 8.7, y: 26.8 },
{},
{ icon: 'seaBus1.png', angle: 0, station: 'Burrard', x: 20.1, y: 82.73333 },
{},
{ icon: 'seaBus1.png', angle: 135, station: 'Granville', x: 24.25, y: 78.5 },
]);
/* */
)
/*
{ station: 'Production Way–University', x: 63.2, y: 63.83 },
{ station: 'Lougheed Town Centre', x: 66.85, y: 63.83 },
*/
createConnector([
{ station: 'Commercial–Broadway', x: 33.8, y: 63.83},
{ station: 'Commercial–Broadway', x: 32.4, y: 61.8 },
{},
{ station: 'Production Way–University', x: 63.2, y: 63.515 },
{},
{ station: 'Lougheed Town Centre', x: 66.85, y: 63.515 },
{},
{ station: 'King George', x: 72.225, y: 23.15 },
{},
{ station: 'Surrey Central', x: 72.225, y: 29.9 },
{},
{ station: 'Oakridge–41st Avenue', x: 22.625, y: 48.625},
{},
{ station: 'Broadway–City Hall', x: 22.625, y: 61.755},
{},
{ station: 'UBC Exchange', x: 2.75, y: 61.8},
{},
{ station: 'Waterfront', x: 23.75, y: 84.25},
{},
{ station: 'Burrard', x: 21.46833, y: 84.25 },
{},
{ station: 'Dunbar Loop', x: 9.85, y: 48.625 },
{},
{ station: 'Kootenay Loop', x: 40.65, y: 81.75 },
{},
{ station: 'VCC–Clark', x: 29.85, y: 66.55 },
{},
{ station: 'Moody Centre', x: 73.64, y: 77.05},
{},
{ station: 'SFU Exchange', x: 63.2, y: 81.75 },
{},
{ station: 'Bridgeport', x: 22.625, y: 28.9 },
{},
{ station: 'Newton Exchange', x: 72.5, y: 2.45 },
{},
{ station: 'Guildford Exchange', x: 88.35, y: 30.95 },
{},
{ station: 'Coquitlam Central', x: 80.5, y: 78 },
{},
{ station: 'Haney Place', x: 98.525, y: 62.925 },
{},
{ station: 'Park Royal', x: 14.4, y: 94.65 },
{},
{ station: 'Lonsdale Quay', x: 30, y: 92.55 },
{ station: 'Lonsdale Quay', x: 28.6, y: 90.6 },
{},
{ station: 'Phibbs Exchange', x: 41.53, y: 92.55 },
]
);