Skip to content

Commit

Permalink
[IMP] demo: add large demo data set for array formulas
Browse files Browse the repository at this point in the history
Task: 4036899
Part-of: #4589
Signed-off-by: Vincent Schippefilt (vsc) <[email protected]>
  • Loading branch information
laa-odoo authored and LucasLefevre committed Jul 5, 2024
1 parent cf1ce77 commit 4d2c4ad
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions demo/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -2109,6 +2109,22 @@ function computeFormulaCells(cols, rows) {
return cells;
}

function computeArrayFormulaCells(cols, rows) {
const cells = {};
const initRow = 4;
for (let row = initRow; row <= rows; row++) {
cells[`A${row}`] = { content: row.toString() };
}
for (let col = 1; col < cols; col++) {
const colLetter = _getColumnLetter(col);
const prev = _getColumnLetter(col - 1);
cells[colLetter + initRow] = {
content: `=transpose(transpose(${prev}${initRow}:${prev}${rows}))`,
};
}
return cells;
}

function computeNumberCells(cols, rows, type = "numbers") {
const cells = {};
for (let col = 0; col < cols; col++) {
Expand Down Expand Up @@ -2156,6 +2172,9 @@ export function makeLargeDataset(cols, rows, sheetsInfo = ["formulas"]) {
case "formulas":
cells = computeFormulaCells(cols, rows);
break;
case "arrayFormulas":
cells = computeArrayFormulaCells(cols, rows);
break;
case "numbers":
case "floats":
case "longFloats":
Expand Down
2 changes: 2 additions & 0 deletions demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ class Demo extends Component {
}
this.createModel(data || demoData);
// this.createModel(makeLargeDataset(26, 10_000, ["numbers"]));
// this.createModel(makeLargeDataset(26, 10_000, ["formulas"]));
// this.createModel(makeLargeDataset(26, 10_000, ["arrayFormulas"]));
// this.createModel({});
}

Expand Down

0 comments on commit 4d2c4ad

Please sign in to comment.