@@ -178,7 +178,6 @@ module.exports = function calc(gd, trace) {
178178 ) ;
179179 } else {
180180 var valArray = valAxis . makeCalcdata ( trace , valLetter ) ;
181- var quartilemethod = trace . quartilemethod ;
182181 var posBins = makeBins ( posDistinct , dPos ) ;
183182 var pLen = posDistinct . length ;
184183 var ptsPerBin = initNestedArray ( pLen ) ;
@@ -199,6 +198,10 @@ module.exports = function calc(gd, trace) {
199198 var minLowerNotch = Infinity ;
200199 var maxUpperNotch = - Infinity ;
201200
201+ var quartilemethod = trace . quartilemethod ;
202+ var usesExclusive = quartilemethod === 'exclusive' ;
203+ var usesInclusive = quartilemethod === 'inclusive' ;
204+
202205 // build calcdata trace items, one item per distinct position
203206 for ( i = 0 ; i < pLen ; i ++ ) {
204207 if ( ptsPerBin [ i ] . length > 0 ) {
@@ -215,15 +218,15 @@ module.exports = function calc(gd, trace) {
215218 cdi . sd = Lib . stdev ( boxVals , N , cdi . mean ) ;
216219 cdi . med = Lib . interp ( boxVals , 0.5 ) ;
217220
218- if ( ( N % 2 ) && ( quartilemethod === 'exclusive' || quartilemethod === 'inclusive' ) ) {
221+ if ( ( N % 2 ) && ( usesExclusive || usesInclusive ) ) {
219222 var lower ;
220223 var upper ;
221224
222- if ( quartilemethod === 'exclusive' ) {
225+ if ( usesExclusive ) {
223226 // do NOT include the median in either half
224227 lower = boxVals . slice ( 0 , N / 2 ) ;
225228 upper = boxVals . slice ( N / 2 + 1 ) ;
226- } else if ( quartilemethod === 'inclusive' ) {
229+ } else if ( usesInclusive ) {
227230 // include the median in either half
228231 lower = boxVals . slice ( 0 , N / 2 + 1 ) ;
229232 upper = boxVals . slice ( N / 2 ) ;
0 commit comments