File tree Expand file tree Collapse file tree
packages/x-charts-pro/src/FunnelChart/curves Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,6 +121,28 @@ export class Linear implements CurveGenerator {
121121 return ;
122122 }
123123
124+ // Add gaps where they are needed.
125+ this . points = this . points . map ( ( point , index ) => {
126+ const slopeStart = this . points . at ( index <= 1 ? 0 : 3 ) ! ;
127+ const slopeEnd = this . points . at ( index <= 1 ? 1 : 2 ) ! ;
128+
129+ if ( this . isHorizontal ) {
130+ const yGetter = lerpY ( slopeStart . x - this . gap , slopeStart . y , slopeEnd . x , slopeEnd . y ) ;
131+
132+ return {
133+ x : point . x ,
134+ y : yGetter ( point . x ) ,
135+ } ;
136+ }
137+
138+ const xGetter = lerpX ( slopeStart . x , slopeStart . y - this . gap , slopeEnd . x , slopeEnd . y ) ;
139+
140+ return {
141+ x : xGetter ( point . y ) ,
142+ y : point . y ,
143+ } ;
144+ } ) ;
145+
124146 if ( this . pointShape === 'sharp' ) {
125147 // In the last section, to form a triangle we need 3 points instead of 4
126148 // Else the algorithm will break.
You can’t perform that action at this time.
0 commit comments