( points: SplinePoint[], options, area: ChartArea, loop: boolean, indexAxis: 'x' | 'y' )
| 184 | * @private |
| 185 | */ |
| 186 | export function _updateBezierControlPoints( |
| 187 | points: SplinePoint[], |
| 188 | options, |
| 189 | area: ChartArea, |
| 190 | loop: boolean, |
| 191 | indexAxis: 'x' | 'y' |
| 192 | ) { |
| 193 | let i: number, ilen: number, point: SplinePoint, controlPoints: ReturnType<typeof splineCurve>; |
| 194 | |
| 195 | // Only consider points that are drawn in case the spanGaps option is used |
| 196 | if (options.spanGaps) { |
| 197 | points = points.filter((pt) => !pt.skip); |
| 198 | } |
| 199 | |
| 200 | if (options.cubicInterpolationMode === 'monotone') { |
| 201 | splineCurveMonotone(points, indexAxis); |
| 202 | } else { |
| 203 | let prev = loop ? points[points.length - 1] : points[0]; |
| 204 | for (i = 0, ilen = points.length; i < ilen; ++i) { |
| 205 | point = points[i]; |
| 206 | controlPoints = splineCurve( |
| 207 | prev, |
| 208 | point, |
| 209 | points[Math.min(i + 1, ilen - (loop ? 0 : 1)) % ilen], |
| 210 | options.tension |
| 211 | ); |
| 212 | point.cp1x = controlPoints.previous.x; |
| 213 | point.cp1y = controlPoints.previous.y; |
| 214 | point.cp2x = controlPoints.next.x; |
| 215 | point.cp2y = controlPoints.next.y; |
| 216 | prev = point; |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | if (options.capBezierPoints) { |
| 221 | capBezierPoints(points, area); |
| 222 | } |
| 223 | } |
no test coverage detected