Skip to content

Commit aff183e

Browse files
load sample arrow data into perspective grid view (#65)
for testing perspective viewer UI setup
1 parent 3b339b3 commit aff183e

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

web/scripts/perspective.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,18 @@ document.addEventListener('DOMContentLoaded', async function () {
1616
});
1717

1818
window.addEventListener('load', async function () {
19-
// create mock data
20-
const data = {
21-
Sales: [500, 1000, 1500],
22-
Profit: [100.25, 200.5, 300.75],
23-
};
19+
// get sample arrow data
20+
const dataRequest = fetch('https://cdn.jsdelivr.net/npm/superstore-arrow/superstore.arrow');
2421

25-
// create worker for data loading
22+
// create worker for table data loading
2623
const worker = perspective.worker();
24+
const dataResponse = await dataRequest;
25+
const arrowData = await dataResponse.arrayBuffer();
2726

2827
// create sample data table
29-
table = worker.table(data);
30-
// table = perspective.table(data);
28+
table = worker.table(arrowData);
3129

32-
// Note: perspective viewer element exposes data table loading API
30+
// load sample data and toggle perspective grid view config
3331
viewer.load(table);
3432
viewer.toggleConfig();
3533
});

0 commit comments

Comments
 (0)