File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 155
155
});
156
156
157
157
let currDate = parseTime (date);
158
- let currDateSeven = d3 .timeDay .offset (currDate, - 7 );
158
+ let currDateSeven = d3 .timeDay .offset (currDate, - 6 );
159
159
// peg values to max and min if out of range
160
160
let minMax = calculateSD (sensor);
161
161
let chartMax = minMax[1 ];
162
162
let chartMin = minMax[0 ];
163
163
164
- for (var i = 0 ; i < data .length ; i++ ) {
164
+ let latest_direction = - 100 ;
165
+ let hit_latest_node = false ;
166
+ for (var i = data .length - 1 ; i >= 0 ; i-- ) {
165
167
let directionDate = parseTime (data[i].time_value );
166
168
if (directionDate >= currDateSeven && directionDate <= currDate) {
167
169
data[i].inDirection = true ;
170
+ if (! hit_latest_node) {
171
+ latest_direction = data[i].direction ;
172
+ data[i].coloredDirection = latest_direction;
173
+ hit_latest_node = true ;
174
+ } else {
175
+ data[i].coloredDirection = latest_direction;
176
+ }
168
177
} else {
169
178
data[i].inDirection = false ;
170
179
}
282
291
.style (' fill' , d => {
283
292
let color = ' #767676' ;
284
293
if (d .inDirection && signal === ' direction' ) {
285
- switch (d .direction ) {
294
+ switch (d .coloredDirection ) {
286
295
case 1 :
287
296
color = DIRECTION_THEME .increasing ;
288
297
break ;
You can’t perform that action at this time.
0 commit comments