@@ -178,31 +178,36 @@ function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) {
178
178
var len = arrayIn . length ;
179
179
180
180
// given vals are brick centers
181
- // hopefully length== numbricks, but use this method even if too few are supplied
181
+ // hopefully length === numbricks, but use this method even if too few are supplied
182
182
// and extend it linearly based on the last two points
183
183
if ( len <= numbricks ) {
184
184
// contour plots only want the centers
185
185
if ( isContour || isGL2D ) arrayOut = arrayIn . slice ( 0 , numbricks ) ;
186
- else if ( numbricks === 1 ) arrayOut = [ arrayIn [ 0 ] - 0.5 , arrayIn [ 0 ] + 0.5 ] ;
186
+ else if ( numbricks === 1 ) {
187
+ arrayOut = [ arrayIn [ 0 ] - 0.5 , arrayIn [ 0 ] + 0.5 ] ;
188
+ }
187
189
else {
188
190
arrayOut = [ 1.5 * arrayIn [ 0 ] - 0.5 * arrayIn [ 1 ] ] ;
191
+
189
192
for ( i = 1 ; i < len ; i ++ ) {
190
193
arrayOut . push ( ( arrayIn [ i - 1 ] + arrayIn [ i ] ) * 0.5 ) ;
191
194
}
195
+
192
196
arrayOut . push ( 1.5 * arrayIn [ len - 1 ] - 0.5 * arrayIn [ len - 2 ] ) ;
193
197
}
194
198
195
199
if ( len < numbricks ) {
196
200
var lastPt = arrayOut [ arrayOut . length - 1 ] ,
197
201
delta = lastPt - arrayOut [ arrayOut . length - 2 ] ;
202
+
198
203
for ( i = len ; i < numbricks ; i ++ ) {
199
204
lastPt += delta ;
200
205
arrayOut . push ( lastPt ) ;
201
206
}
202
207
}
203
208
}
204
209
else {
205
- // hopefully length== numbricks+1, but do something regardless:
210
+ // hopefully length === numbricks+1, but do something regardless:
206
211
// given vals are brick boundaries
207
212
return isContour ?
208
213
arrayIn . slice ( 0 , numbricks ) : // we must be strict for contours
@@ -219,6 +224,7 @@ function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) {
219
224
arrayOut . push ( v0 + dv * i ) ;
220
225
}
221
226
}
227
+
222
228
return arrayOut ;
223
229
}
224
230
0 commit comments