@@ -178,31 +178,36 @@ function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) {
178178 var len = arrayIn . length ;
179179
180180 // 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
182182 // and extend it linearly based on the last two points
183183 if ( len <= numbricks ) {
184184 // contour plots only want the centers
185185 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+ }
187189 else {
188190 arrayOut = [ 1.5 * arrayIn [ 0 ] - 0.5 * arrayIn [ 1 ] ] ;
191+
189192 for ( i = 1 ; i < len ; i ++ ) {
190193 arrayOut . push ( ( arrayIn [ i - 1 ] + arrayIn [ i ] ) * 0.5 ) ;
191194 }
195+
192196 arrayOut . push ( 1.5 * arrayIn [ len - 1 ] - 0.5 * arrayIn [ len - 2 ] ) ;
193197 }
194198
195199 if ( len < numbricks ) {
196200 var lastPt = arrayOut [ arrayOut . length - 1 ] ,
197201 delta = lastPt - arrayOut [ arrayOut . length - 2 ] ;
202+
198203 for ( i = len ; i < numbricks ; i ++ ) {
199204 lastPt += delta ;
200205 arrayOut . push ( lastPt ) ;
201206 }
202207 }
203208 }
204209 else {
205- // hopefully length== numbricks+1, but do something regardless:
210+ // hopefully length === numbricks+1, but do something regardless:
206211 // given vals are brick boundaries
207212 return isContour ?
208213 arrayIn . slice ( 0 , numbricks ) : // we must be strict for contours
@@ -219,6 +224,7 @@ function makeBoundArray(trace, arrayIn, v0In, dvIn, numbricks, ax) {
219224 arrayOut . push ( v0 + dv * i ) ;
220225 }
221226 }
227+
222228 return arrayOut ;
223229}
224230
0 commit comments