回答編集履歴

2

サンプルコードを追加

2019/07/02 14:52

投稿

KuwabataK
KuwabataK

スコア306

test CHANGED
@@ -1,4 +1,6 @@
1
1
  こんな感じですかね。
2
+
3
+ [サンプルコード](https://playcode.io/360492?tabs=script.js,preview,console)
2
4
 
3
5
 
4
6
 

1

変数名を少し修正

2019/07/02 14:52

投稿

KuwabataK
KuwabataK

スコア306

test CHANGED
@@ -136,10 +136,6 @@
136
136
 
137
137
 
138
138
 
139
-
140
-
141
-
142
-
143
139
  const flatData = directionData.map((dir) => {
144
140
 
145
141
  return seasonData.map(season => {
@@ -150,7 +146,7 @@
150
146
 
151
147
  'season': season.season,
152
148
 
153
- 'data': shadowData.filter(shadow => shadow.direction === dir.direction && shadow.season === season.season)
149
+ 'shadow': shadowData.filter(shadow => shadow.direction === dir.direction && shadow.season === season.season)
154
150
 
155
151
  }
156
152
 
@@ -168,7 +164,7 @@
168
164
 
169
165
  timeData.forEach(time => {
170
166
 
171
- r[time] = d.data.find(_d => _d.time === time) ? d.data.find(_d => _d.time === time).state : 'none'
167
+ r[time] = d.shadow.find(_d => _d.time === time) ? d.shadow.find(_d => _d.time === time).state : 'none'
172
168
 
173
169
  })
174
170