@@ -43,12 +43,29 @@ function calcOneAxis(calcTrace, trace, axis, coord) {
43
43
var computeError = makeComputeError ( opts ) ;
44
44
45
45
for ( var i = 0 ; i < calcTrace . length ; i ++ ) {
46
- var calcPt = calcTrace [ i ] ,
47
- calcCoord = calcPt [ coord ] ;
46
+ var calcPt = calcTrace [ i ] ;
47
+
48
+ var iIn = calcPt . i ;
49
+
50
+ // for types that don't include `i` in each calcdata point
51
+ if ( iIn === undefined ) iIn = i ;
52
+
53
+ // for stacked area inserted points
54
+ // TODO: errorbars have been tested cursorily with stacked area,
55
+ // but not thoroughly. It's not even really clear what you want to do:
56
+ // Should it just be calculated based on that trace's size data?
57
+ // Should you add errors from below in quadrature?
58
+ // And what about normalization, where in principle the errors shrink
59
+ // again when you get up to the top end?
60
+ // One option would be to forbid errorbars with stacking until we
61
+ // decide how to handle these questions.
62
+ else if ( iIn === null ) continue ;
63
+
64
+ var calcCoord = calcPt [ coord ] ;
48
65
49
66
if ( ! isNumeric ( axis . c2l ( calcCoord ) ) ) continue ;
50
67
51
- var errors = computeError ( calcCoord , i ) ;
68
+ var errors = computeError ( calcCoord , iIn ) ;
52
69
if ( isNumeric ( errors [ 0 ] ) && isNumeric ( errors [ 1 ] ) ) {
53
70
var shoe = calcPt [ coord + 's' ] = calcCoord - errors [ 0 ] ,
54
71
hat = calcPt [ coord + 'h' ] = calcCoord + errors [ 1 ] ;
0 commit comments