MCPcopy
hub / github.com/chartjs/Chart.js / addPointsBelow

Function addPointsBelow

src/plugins/plugin.filler/filler.target.stack.js:58–79  ·  view source on GitHub ↗

* @param {PointElement[]} points * @param {PointElement} sourcePoint * @param {LineElement[]} linesBelow

(points, sourcePoint, linesBelow)

Source from the content-addressed store, hash-verified

56 * @param {LineElement[]} linesBelow
57 */
58function addPointsBelow(points, sourcePoint, linesBelow) {
59 const postponed = [];
60 for (let j = 0; j < linesBelow.length; j++) {
61 const line = linesBelow[j];
62 const {first, last, point} = findPoint(line, sourcePoint, 'x');
63
64 if (!point || (first && last)) {
65 continue;
66 }
67 if (first) {
68 // First point of a segment -> need to add another point before this,
69 postponed.unshift(point);
70 } else {
71 points.push(point);
72 if (!last) {
73 // In the middle of a segment, no need to add more points.
74 break;
75 }
76 }
77 }
78 points.push(...postponed);
79}
80
81/**
82 * @param {LineElement} line

Callers 1

_buildStackLineFunction · 0.85

Calls 1

findPointFunction · 0.85

Tested by

no test coverage detected