Skip to content

Commit

Permalink
Added formating of data for direct copy to excel
Browse files Browse the repository at this point in the history
  • Loading branch information
safa0 committed Oct 26, 2024
1 parent 3f3b673 commit d6b8a76
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions examples/sticky-pair-clusterer/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -874,10 +874,10 @@ document

document.getElementById("debugButton").addEventListener("click", () => {
console.log("Debug button clicked");
generate2DMatrixFromTags();
generateTableFromTags();
});

function generate2DMatrixFromTags(
function generateTableFromTags(
rowNames = g_matrix.rowNames,
columnNames = g_matrix.columnNames,
) {
Expand Down Expand Up @@ -925,6 +925,14 @@ function generate2DMatrixFromTags(
}
}
}
console.log("Generated 2D matrix:", matrix);
return matrix;

// Convert the matrix to a tab-separated string
const excelFormattedString = matrix.map((row) => row.join("\t")).join("\n");
console.log("Excel formatted matrix:\n", excelFormattedString);

// Write the excelFormattedString to clipboard
navigator.clipboard.writeText(excelFormattedString);
board.notifications.showInfo("Matrix data copied to clipboard.");
console.log("Matrix data copied to clipboard");
return excelFormattedString;
}

0 comments on commit d6b8a76

Please sign in to comment.