MCPcopy Create free account
hub / github.com/plotly/plotly.js / makeAnchorToRowBlock

Function makeAnchorToRowBlock

src/traces/table/data_preparation_helper.js:156–184  ·  view source on GitHub ↗
(rowHeights, minimumFillHeight)

Source from the content-addressed store, hash-verified

154}
155
156function makeAnchorToRowBlock(rowHeights, minimumFillHeight) {
157 var anchorToRowBlock = {};
158 var currentRowHeight;
159 var currentAnchor = 0;
160 var currentBlockHeight = 0;
161 var currentBlock = makeIdentity();
162 var currentFirstRowIndex = 0;
163 var blockCounter = 0;
164 for(var i = 0; i < rowHeights.length; i++) {
165 currentRowHeight = rowHeights[i];
166 currentBlock.rows.push({
167 rowIndex: i,
168 rowHeight: currentRowHeight
169 });
170 currentBlockHeight += currentRowHeight;
171 if(currentBlockHeight >= minimumFillHeight || i === rowHeights.length - 1) {
172 anchorToRowBlock[currentAnchor] = currentBlock;
173 currentBlock.key = blockCounter++;
174 currentBlock.firstRowIndex = currentFirstRowIndex;
175 currentBlock.lastRowIndex = i;
176 currentBlock = makeIdentity();
177 currentAnchor += currentBlockHeight;
178 currentFirstRowIndex = i + 1;
179 currentBlockHeight = 0;
180 }
181 }
182
183 return anchorToRowBlock;
184}
185
186function makeIdentity() {
187 return {

Callers 1

Calls 1

makeIdentityFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…