@@ -38,6 +38,10 @@ module.exports = function plot(gd, plotinfo, cdbar, barLayer) {
38
38
var cd0 = cd [ 0 ] ;
39
39
var trace = cd0 . trace ;
40
40
41
+ var isWaterfall = ( trace . type === 'waterfall' ) ;
42
+ var isTriangle = ( isWaterfall ) ? ( trace . marker . shape === 'triangle' ) : false ;
43
+ var isVertical = ( trace . orientation === 'v' ) ;
44
+
41
45
if ( ! plotinfo . isRangePlot ) cd0 . node3 = plotGroup ;
42
46
43
47
var pointGroup = Lib . ensureSingle ( plotGroup , 'g' , 'points' ) ;
@@ -111,6 +115,7 @@ module.exports = function plot(gd, plotinfo, cdbar, barLayer) {
111
115
// pixelation. if the bars ARE fully opaque and have
112
116
// no line, expand to a full pixel to make sure we
113
117
// can see them
118
+
114
119
var op = Color . opacity ( di . mc || trace . marker . color ) ;
115
120
var fixpx = ( op < 1 || lw > 0.01 ) ? roundWithLine : expandToVisible ;
116
121
x0 = fixpx ( x0 , x1 ) ;
@@ -119,11 +124,21 @@ module.exports = function plot(gd, plotinfo, cdbar, barLayer) {
119
124
y1 = fixpx ( y1 , y0 ) ;
120
125
}
121
126
127
+ var shape ;
128
+ if ( isWaterfall && isTriangle && i > 0 && cd [ i ] . isFall === false ) {
129
+ if ( isVertical ) {
130
+ shape = 'M' + x0 + ',' + y0 + 'L' + ( 0.5 * ( x1 + x0 ) ) + ',' + y1 + 'L' + x1 + ',' + y0 + 'Z' ;
131
+ } else {
132
+ shape = 'M' + x0 + ',' + y0 + 'L' + x1 + ',' + ( 0.5 * ( y1 + y0 ) ) + 'L' + x0 + ',' + y1 + 'Z' ;
133
+ }
134
+ } else {
135
+ shape = 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z' ;
136
+ }
137
+
122
138
Lib . ensureSingle ( bar , 'path' )
123
- . style ( 'vector-effect' , 'non-scaling-stroke' )
124
- . attr ( 'd' ,
125
- 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z' )
126
- . call ( Drawing . setClipUrl , plotinfo . layerClipId , gd ) ;
139
+ . style ( 'vector-effect' , 'non-scaling-stroke' )
140
+ . attr ( 'd' , shape )
141
+ . call ( Drawing . setClipUrl , plotinfo . layerClipId , gd ) ;
127
142
128
143
appendBarText ( gd , bar , cd , i , x0 , x1 , y0 , y1 ) ;
129
144
0 commit comments