質問編集履歴
2
最終結果の追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -314,6 +314,22 @@
|
|
314
314
|
|
315
315
|
|
316
316
|
|
317
|
+
###最終的にどうなってほしいのか
|
318
|
+
|
319
|
+
以下のような形式のCSVファイルでの書き出しを行いたい
|
320
|
+
|
321
|
+
■■■■■ t8 t9 t10 t11 t12 t13 t14 t15 t16
|
322
|
+
|
323
|
+
NE_spring prital, shadow, shadow, shadow, shadow, shadow, shadow, shadow, shadow
|
324
|
+
|
325
|
+
NE_summer prital, shadow, shadow, shadow, shadow, shadow, shadow, shadow, shadow
|
326
|
+
|
327
|
+
NE_winter shadow, shadow, shadow, shadow, shadow, shadow, shadow, shadow, shadow
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
以下略
|
332
|
+
|
317
333
|
|
318
334
|
|
319
335
|
### 補足情報(FW/ツールのバージョンなど)
|
1
具体的な例、ソースコードの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -14,35 +14,59 @@
|
|
14
14
|
|
15
15
|
|
16
16
|
|
17
|
+
具体的な例
|
18
|
+
|
17
19
|
---
|
18
20
|
|
21
|
+
data.json内のshadowDataを direction,seasonでfilterをかける
|
22
|
+
|
23
|
+
|
24
|
+
|
19
|
-
|
25
|
+
↓
|
26
|
+
|
27
|
+
|
28
|
+
|
20
|
-
|
29
|
+
一致したデータを個別に配列化
|
30
|
+
|
31
|
+
(方角 NEの季節 spring配列、方角 NEの季節 summer配列のように…)
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
↓
|
36
|
+
|
37
|
+
|
38
|
+
|
21
|
-
|
39
|
+
配列化したデータの中身を確認、存在するデータの時間を見て、連想配列にstateを格納、存在しないデータの時間はすべてnoneにする。
|
22
|
-
|
23
|
-
|
40
|
+
|
41
|
+
|
24
42
|
|
25
43
|
{"time":"8:00", "season":"spring", "direction":"NE", "state":"partial"},
|
26
44
|
|
27
|
-
|
45
|
+
↓NEのspring には 8:00 のみ存在
|
28
|
-
|
46
|
+
|
29
|
-
{"8:00":"pratial","9:00":"none","10:00":"none","11:00":"none","12:00":"none","13:00":"none","14:00":"none","15:00":"none","16:00":"none" }
|
47
|
+
NE_spring{"8:00":"pratial","9:00":"none","10:00":"none","11:00":"none","12:00":"none","13:00":"none","14:00":"none","15:00":"none","16:00":"none" },
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
48
|
+
|
34
|
-
|
35
|
-
{"time":"16:00", "season":"spring", "direction":"NW", "state":"partial"},
|
36
|
-
|
37
|
-
↓ NWのspring には 15:00と16:00 が存在
|
38
|
-
|
39
|
-
{"8:00":"
|
49
|
+
NE_summer{"8:00":"pratial","9:00":"none","10:00":"none","11:00":"none","12:00":"none","13:00":"none","14:00":"none","15:00":"none","16:00":"none" }.....以下略
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
↓
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
(作成した連想配列をループ処理で参照してCSVで列として書き出し)
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
というプログラムを考えておりましたが自分の知識不足でうまく配列化、データの取り出しができずCSVを書き出した際undefinedになってしまいまっています。
|
62
|
+
|
63
|
+
|
40
64
|
|
41
65
|
|
42
66
|
|
43
67
|
### 発生している問題・エラーメッセージ
|
44
68
|
|
45
|
-
季節と方角毎にフィルターをかけ
|
69
|
+
季節と方角毎にフィルターをかけるところまでは成功しましたがそこから先がわかりません…
|
46
70
|
|
47
71
|
|
48
72
|
|
@@ -60,25 +84,51 @@
|
|
60
84
|
|
61
85
|
```JavaScript
|
62
86
|
|
87
|
+
let i = 0;
|
88
|
+
|
89
|
+
let n = 0;
|
90
|
+
|
91
|
+
let b = 0;
|
92
|
+
|
63
93
|
let replaceTime = [];
|
64
94
|
|
65
95
|
let replaceDirection = [];
|
66
96
|
|
67
97
|
let getShadowData = [];
|
68
98
|
|
99
|
+
let replaceState = [];
|
100
|
+
|
69
101
|
let replaceText = '';
|
70
102
|
|
71
103
|
|
72
104
|
|
73
|
-
for(let i in
|
105
|
+
for(let i in timeData) {
|
74
|
-
|
106
|
+
|
75
|
-
replaceTime[i] = 'T' + t
|
107
|
+
replaceTime[i] = 'T' + timeData[i].replace(/:00/g, '');
|
76
108
|
|
77
109
|
}
|
78
110
|
|
79
|
-
|
111
|
+
var csv = '\ufeff' + '&shadowData=DIR_SEASON' + ',' + replaceTime +'\n'
|
80
|
-
|
112
|
+
|
113
|
+
|
114
|
+
|
81
|
-
for(let i in
|
115
|
+
for(let i in directionData) {
|
116
|
+
|
117
|
+
replaceDirection[i] = directionData[i].direction
|
118
|
+
|
119
|
+
getShadowData = shadowData.filter(x => x.direction == directionData[i].direction)
|
120
|
+
|
121
|
+
for(let n in seasonData) {
|
122
|
+
|
123
|
+
replaceText = replaceDirection[i] + '_' + seasonData[n].season;
|
124
|
+
|
125
|
+
replaceState.push(getShadowData.filter(x => x.season == seasonData[n].season));
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
}
|
130
|
+
|
131
|
+
directionData.forEach(el => {
|
82
132
|
|
83
133
|
replaceDirection[i] = this.directionData[i].direction
|
84
134
|
|
@@ -86,13 +136,31 @@
|
|
86
136
|
|
87
137
|
replaceText = replaceDirection[i] + '_' + this.seasonData[n].season
|
88
138
|
|
139
|
+
for (let b in replaceText) {
|
140
|
+
|
89
|
-
|
141
|
+
var line = '\ufeff' + replaceText + ',' + replaceState[b].state +'\n'
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
csv += line
|
90
146
|
|
91
147
|
}
|
92
148
|
|
149
|
+
i++
|
150
|
+
|
93
|
-
}
|
151
|
+
})
|
152
|
+
|
153
|
+
|
154
|
+
|
94
|
-
|
155
|
+
let blob = new Blob([csv], { type: 'text/csv' });
|
156
|
+
|
157
|
+
let link = document.createElement('a')
|
158
|
+
|
159
|
+
link.href = window.URL.createObjectURL(blob)
|
160
|
+
|
95
|
-
|
161
|
+
link.download = 'shadowData.csv'
|
162
|
+
|
163
|
+
link.click()
|
96
164
|
|
97
165
|
```
|
98
166
|
|
@@ -150,7 +218,87 @@
|
|
150
218
|
|
151
219
|
{"time":"16:00", "season":"winter", "direction":"NW", "state":"partial"},
|
152
220
|
|
221
|
+
|
222
|
+
|
223
|
+
{"time":"8:00", "season":"spring", "direction":"SE", "state":"partial"},
|
224
|
+
|
225
|
+
{"time":"9:00", "season":"spring", "direction":"SE", "state":"partial"},
|
226
|
+
|
227
|
+
{"time":"10:00", "season":"spring", "direction":"SE", "state":"partial"},
|
228
|
+
|
229
|
+
{"time":"11:00", "season":"spring", "direction":"SE", "state":"partial"},
|
230
|
+
|
231
|
+
{"time":"12:00", "season":"spring", "direction":"SE", "state":"partial"},
|
232
|
+
|
233
|
+
{"time":"13:00", "season":"spring", "direction":"SE", "state":"partial"},
|
234
|
+
|
235
|
+
{"time":"8:00", "season":"summer", "direction":"SE", "state":"partial"},
|
236
|
+
|
237
|
+
{"time":"9:00", "season":"summer", "direction":"SE", "state":"partial"},
|
238
|
+
|
239
|
+
{"time":"10:00", "season":"summer", "direction":"SE", "state":"partial"},
|
240
|
+
|
241
|
+
{"time":"11:00", "season":"summer", "direction":"SE", "state":"partial"},
|
242
|
+
|
243
|
+
{"time":"12:00", "season":"summer", "direction":"SE", "state":"partial"},
|
244
|
+
|
245
|
+
{"time":"8:00", "season":"winter", "direction":"SE", "state":"partial"},
|
246
|
+
|
247
|
+
{"time":"9:00", "season":"winter", "direction":"SE", "state":"partial"},
|
248
|
+
|
249
|
+
{"time":"10:00", "season":"winter", "direction":"SE", "state":"partial"},
|
250
|
+
|
251
|
+
{"time":"11:00", "season":"winter", "direction":"SE", "state":"partial"},
|
252
|
+
|
253
|
+
{"time":"12:00", "season":"winter", "direction":"SE", "state":"partial"},
|
254
|
+
|
255
|
+
{"time":"13:00", "season":"winter", "direction":"SE", "state":"partial"},
|
256
|
+
|
257
|
+
{"time":"14:00", "season":"winter", "direction":"SE", "state":"partial"},
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
{"time":"10:00", "season":"spring", "direction":"SW", "state":"partial"},
|
262
|
+
|
263
|
+
{"time":"11:00", "season":"spring", "direction":"SW", "state":"partial"},
|
264
|
+
|
265
|
+
{"time":"12:00", "season":"spring", "direction":"SW", "state":"partial"},
|
266
|
+
|
267
|
+
{"time":"13:00", "season":"spring", "direction":"SW", "state":"partial"},
|
268
|
+
|
269
|
+
{"time":"14:00", "season":"spring", "direction":"SW", "state":"partial"},
|
270
|
+
|
271
|
+
{"time":"15:00", "season":"spring", "direction":"SW", "state":"partial"},
|
272
|
+
|
273
|
+
{"time":"16:00", "season":"spring", "direction":"SW", "state":"partial"},
|
274
|
+
|
275
|
+
{"time":"12:00", "season":"summer", "direction":"SW", "state":"partial"},
|
276
|
+
|
277
|
+
{"time":"13:00", "season":"summer", "direction":"SW", "state":"partial"},
|
278
|
+
|
279
|
+
{"time":"14:00", "season":"summer", "direction":"SW", "state":"partial"},
|
280
|
+
|
281
|
+
{"time":"15:00", "season":"summer", "direction":"SW", "state":"partial"},
|
282
|
+
|
283
|
+
{"time":"16:00", "season":"summer", "direction":"SW", "state":"partial"},
|
284
|
+
|
285
|
+
{"time":"8:00", "season":"winter", "direction":"SW", "state":"partial"},
|
286
|
+
|
287
|
+
{"time":"9:00", "season":"winter", "direction":"SW", "state":"partial"},
|
288
|
+
|
289
|
+
{"time":"10:00", "season":"winter", "direction":"SW", "state":"partial"},
|
290
|
+
|
291
|
+
{"time":"11:00", "season":"winter", "direction":"SW", "state":"partial"},
|
292
|
+
|
293
|
+
{"time":"12:00", "season":"winter", "direction":"SW", "state":"partial"},
|
294
|
+
|
295
|
+
{"time":"13:00", "season":"winter", "direction":"SW", "state":"partial"},
|
296
|
+
|
297
|
+
{"time":"14:00", "season":"winter", "direction":"SW", "state":"partial"},
|
298
|
+
|
299
|
+
{"time":"15:00", "season":"winter", "direction":"SW", "state":"partial"},
|
300
|
+
|
153
|
-
|
301
|
+
{"time":"16:00", "season":"winter", "direction":"SW", "state":"partial"}
|
154
302
|
|
155
303
|
|
156
304
|
|