@@ -34,30 +34,39 @@ module.exports = function plot(gd, plotinfo, cdbar) {
34
34
. attr ( 'class' , 'points' )
35
35
. each ( function ( d ) {
36
36
var t = d [ 0 ] . t ,
37
- trace = d [ 0 ] . trace ;
37
+ trace = d [ 0 ] . trace ,
38
+ poffset = t . poffset ,
39
+ poffsetIsArray = Array . isArray ( poffset ) ,
40
+ barwidth = t . barwidth ,
41
+ barwidthIsArray = Array . isArray ( barwidth ) ;
38
42
39
43
arraysToCalcdata ( d ) ;
40
44
41
45
d3 . select ( this ) . selectAll ( 'path' )
42
46
. data ( Lib . identity )
43
47
. enter ( ) . append ( 'path' )
44
- . each ( function ( di ) {
48
+ . each ( function ( di , i ) {
45
49
// now display the bar
46
50
// clipped xf/yf (2nd arg true): non-positive
47
51
// log values go off-screen by plotwidth
48
52
// so you see them continue if you drag the plot
53
+ var p0 = di . p + ( ( poffsetIsArray ) ? poffset [ i ] : poffset ) ,
54
+ p1 = p0 + ( ( barwidthIsArray ) ? barwidth [ i ] : barwidth ) ,
55
+ s0 = di . b ,
56
+ s1 = s0 + di . s ;
57
+
49
58
var x0 , x1 , y0 , y1 ;
50
59
if ( trace . orientation === 'h' ) {
51
- y0 = ya . c2p ( t . poffset + di . p , true ) ;
52
- y1 = ya . c2p ( t . poffset + di . p + t . barwidth , true ) ;
53
- x0 = xa . c2p ( di . b , true ) ;
54
- x1 = xa . c2p ( di . s + di . b , true ) ;
60
+ y0 = ya . c2p ( p0 , true ) ;
61
+ y1 = ya . c2p ( p1 , true ) ;
62
+ x0 = xa . c2p ( s0 , true ) ;
63
+ x1 = xa . c2p ( s1 , true ) ;
55
64
}
56
65
else {
57
- x0 = xa . c2p ( t . poffset + di . p , true ) ;
58
- x1 = xa . c2p ( t . poffset + di . p + t . barwidth , true ) ;
59
- y1 = ya . c2p ( di . s + di . b , true ) ;
60
- y0 = ya . c2p ( di . b , true ) ;
66
+ x0 = xa . c2p ( p0 , true ) ;
67
+ x1 = xa . c2p ( p1 , true ) ;
68
+ y0 = ya . c2p ( s0 , true ) ;
69
+ y1 = ya . c2p ( s1 , true ) ;
61
70
}
62
71
63
72
if ( ! isNumeric ( x0 ) || ! isNumeric ( x1 ) ||
0 commit comments