-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add number aggregates to date{time}s. Move examples to repo.
- Loading branch information
1 parent
d781d2a
commit b91c3ae
Showing
18 changed files
with
1,265 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,3 +218,5 @@ playwright/.cache/ | |
|
||
.pyodide-xbuildenv | ||
benchmark_venv | ||
|
||
venv/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
license: apache-2.0 | ||
height: 800 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
A demo showing some visualization of decks of Magic: The Gathering decks. | ||
|
||
Deck lists were provided by Evan Wolfe, thanks!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
{ | ||
"GR COUNTERS": [ | ||
["ONE", "118", 1], | ||
["CMR", "297", 1], | ||
["DDP", "1", 1], | ||
["ZNR", "180", 1], | ||
["PAFR", "217s", 1], | ||
["CLB", "300", 1], | ||
["SLD", "323", 1], | ||
["DMR", "336", 1], | ||
["NEO", "501", 1], | ||
["AFC", "153", 1], | ||
["STA", "36", 1], | ||
["40K", "269", 1], | ||
["CMR", "350", 1], | ||
["SLU", "16", 1], | ||
["SLD", "376", 1], | ||
["M21", "317", 1], | ||
["DMU", "160", 1], | ||
["CMM", "532", 1], | ||
["LTR", "158", 1], | ||
["CMM", "1067", 1], | ||
["CMM", "534", 1], | ||
["MOM", "298", 1], | ||
["2X2", "368", 1], | ||
["ORI", "176", 1], | ||
["CMM", "558", 1], | ||
["PW21", "4", 1], | ||
["F13", "3", 1], | ||
["CMM", "700", 1], | ||
["AFR", "281", 8], | ||
["DMR", "341", 1], | ||
["MH2", "421", 1], | ||
["PLIST", "777", 1], | ||
["VOW", "325", 1], | ||
["WOT", "55", 1], | ||
["KHM", "261", 1], | ||
["C21", "195", 1], | ||
["JMP", "404", 1], | ||
["CMM", "542", 1], | ||
["SLD", "517", 1], | ||
["CMR", "581", 1], | ||
["DMU", "250", 1], | ||
["SLD", "355", 1], | ||
["NEO", "199", 1], | ||
["CMM", "649", 1], | ||
["MOM", "244", 1], | ||
["F10", "8", 1], | ||
["CLB", "401", 1], | ||
["MH2", "428", 1], | ||
["IKO", "276", 1], | ||
["SNC", "439", 1], | ||
["C21", "199", 1], | ||
["LTR", "342", 1], | ||
["NEO", "250", 1], | ||
["CLB", "465", 7], | ||
["DMR", "346", 1], | ||
["CMM", "566", 1], | ||
["CMM", "309", 1], | ||
["MOM", "198", 1], | ||
["UMA", "176", 1], | ||
["PELD", "171p", 1], | ||
["2X2", "371", 1], | ||
["PAER", "96s", 1], | ||
["DMU", "236", 1], | ||
["PLG20", "1", 1], | ||
["LTR", "427", 1], | ||
["MID", "284", 1], | ||
["H09", "32", 1], | ||
["C18", "160", 1], | ||
["MAT", "145", 1], | ||
["MB1", "1330", 1], | ||
["AKH", "248", 1], | ||
["2XM", "348", 1], | ||
["NEO", "504", 1], | ||
["PLG22", "1", 1], | ||
["CLB", "606", 1], | ||
["UNF", "280", 1], | ||
["SLD", "1055", 1], | ||
["THB", "244", 1], | ||
["CMM", "294", 1], | ||
["IKO", "237", 1], | ||
["LTR", "345", 1], | ||
["SNC", "289", 1], | ||
["BRO", "194", 1], | ||
["CMM", "652", 1], | ||
["KHM", "319", 1], | ||
["PM21", "167p", 1], | ||
["ZNR", "173", 1], | ||
["ZNR", "364", 1], | ||
["MOM", "301", 1], | ||
["KHM", "199", 1], | ||
["CLB", "206", 1], | ||
["DMR", "185", 1], | ||
["LTC", "377", 1], | ||
["AFR", "285", 1], | ||
["ONE", "356", 1] | ||
], | ||
"UB Control": [ | ||
["SCH", "11", 1], | ||
["ZNR", "336", 1], | ||
["SNC", "51", 1], | ||
["LTC", "357", 1], | ||
["A25", "41", 1], | ||
["CMR", "297", 1], | ||
["SLD", "399", 1], | ||
["BRR", "4", 1], | ||
["STX", "301", 1], | ||
["LTR", "340", 1], | ||
["2XM", "232", 1], | ||
["PLG21", "3", 1], | ||
["GDY", "8", 1], | ||
["PELD", "39s", 1], | ||
["LTC", "360", 1], | ||
["SLU", "15", 1], | ||
["SLD", "470", 1], | ||
["CMR", "350", 1], | ||
["SLD", "165", 1], | ||
["DMR", "45", 1], | ||
["2X2", "353", 1], | ||
["SLD", "1170", 1], | ||
["ONE", "372", 1], | ||
["MH2", "397", 1], | ||
["CMM", "695", 1], | ||
["CLB", "444", 1], | ||
["CMM", "509", 1], | ||
["2X2", "404", 1], | ||
["2XM", "255", 1], | ||
["PW21", "4", 1], | ||
["40K", "181", 1], | ||
["MOM", "352", 1], | ||
["ZNR", "328", 1], | ||
["UMA", "58", 1], | ||
["SLD", "365", 1], | ||
["ZNR", "339", 1], | ||
["MOM", "360", 1], | ||
["2X2", "354", 1], | ||
["KLD", "247", 1], | ||
["ONE", "268", 4], | ||
["SLD", "510", 1], | ||
["SLC", "1996", 1], | ||
["MH2", "428", 1], | ||
["SLD", "1012a", 1], | ||
["CMR", "80", 1], | ||
["PELD", "54s", 1], | ||
["SLD", "1272", 1], | ||
["SHM", "276", 1], | ||
["CLB", "603", 1], | ||
["J16", "5", 1], | ||
["SLD", "406", 1], | ||
["SLD", "334", 1], | ||
["SLC", "1995", 1], | ||
["DMR", "427", 1], | ||
["CMR", "141", 1], | ||
["LTR", "433", 1], | ||
["MH2", "430", 1], | ||
["NEO", "271", 1], | ||
["SLD", "1002", 1], | ||
["2X2", "396", 1], | ||
["PNPH", "42", 1], | ||
["PHOU", "73s", 1], | ||
["PD3", "15", 1], | ||
["CMR", "710", 1], | ||
["STX", "51", 1], | ||
["SLD", "478", 1], | ||
["LTC", "352", 1], | ||
["MH2", "303", 1], | ||
["LTR", "344", 1], | ||
["M20", "113", 1], | ||
["ZNR", "333", 1], | ||
["DMU", "435", 1], | ||
["PLG22", "1", 1], | ||
["SLD", "1113", 1], | ||
["SLD", "1022", 1], | ||
["40K", "295", 1], | ||
["ONE", "269", 4], | ||
["NEO", "278", 1], | ||
["SLD", "1053", 1], | ||
["THS", "225", 1], | ||
["MM2", "62", 1], | ||
["LTR", "451", 1], | ||
["PLG22", "2", 1], | ||
["CMM", "523", 1], | ||
["BRO", "267", 1], | ||
["M15", "248", 1], | ||
["CMR", "156", 1], | ||
["V13", "15", 1], | ||
["UNF", "278", 1], | ||
["CLB", "344", 1], | ||
["P30A", "6", 1], | ||
["ELD", "357", 1], | ||
["DMR", "315", 1] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<html> | ||
<head> | ||
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" /> | ||
|
||
<link rel="stylesheet" crossorigin="anonymous" href="/node_modules/@finos/perspective-viewer/dist/css/pro.css" /> | ||
<link rel="stylesheet" crossorigin="anonymous" href="/node_modules/@finos/perspective-workspace/dist/css/pro.css" /> | ||
|
||
<script type="module" src="/node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js"></script> | ||
<script type="module" src="/node_modules/@finos/perspective-workspace/dist/cdn/perspective-workspace.js"></script> | ||
<script type="module" src="/node_modules/@finos/perspective-viewer-datagrid/dist/cdn/perspective-viewer-datagrid.js"></script> | ||
<script type="module" src="/node_modules/@finos/perspective-viewer-d3fc/dist/cdn/perspective-viewer-d3fc.js"></script> | ||
<script type="module" src="/node_modules/@finos/perspective/dist/cdn/perspective.js"></script> | ||
<script type="module" src="./index.js"></script> | ||
</head> | ||
<body> | ||
<div id="header"> | ||
<select id="deck_selector"></select> | ||
<span id="message"></span> | ||
</div> | ||
<perspective-workspace id="workspace"></perspective-workspace> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ | ||
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃ | ||
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃ | ||
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃ | ||
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃ | ||
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ | ||
// ┃ Copyright (c) 2017, the Perspective Authors. ┃ | ||
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃ | ||
// ┃ This file is part of the Perspective library, distributed under the terms ┃ | ||
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ | ||
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ | ||
|
||
import perspective from "/node_modules/@finos/perspective/dist/cdn/perspective.js"; | ||
|
||
const WORKER = perspective.worker(); | ||
|
||
let DECKS = {}; | ||
|
||
async function createDeck(deck, library) { | ||
let fragments = []; | ||
let multis = []; | ||
for (let card of deck) { | ||
let frag = `("setCode" == '${card[0]}' and "number" == '${card[1]}')`; | ||
fragments.push(frag); | ||
if (card[2] !== 1) { | ||
multis.push([frag, card[2]]); | ||
} | ||
} | ||
let multiExpr = ""; | ||
if (multis.length === 0) { | ||
multiExpr = "1"; | ||
} else { | ||
let a = multis.map(([m, n]) => `else if ${m} {${n}}`); | ||
multiExpr = `// count\n\nif (false) { 0 }${a.join(" ")}else { 1 }`; | ||
} | ||
let expr = fragments.join(" or "); | ||
let view = await library.view({ | ||
expressions: [expr, multiExpr], | ||
filter: [[expr, "==", true]], | ||
}); | ||
let data = await view.to_json(); | ||
view.delete(); | ||
return WORKER.table(data); | ||
} | ||
|
||
async function getDeckTable(name, decks) { | ||
let main = DECKS["__mainLibrary"]; | ||
if (DECKS[name] !== undefined) { | ||
return DECKS[name]; | ||
} | ||
window.message.textContent = "Building deck..."; | ||
let deck = await createDeck(decks[name], main); | ||
console.log("New Deck: ", deck); | ||
DECKS[name] = deck; | ||
window.message.textContent = ""; | ||
return DECKS[name]; | ||
} | ||
|
||
async function createMainTable() { | ||
window.message.textContent = "Downloading..."; | ||
let url = "http://localhost:8082/data/all_identifiers.arrow"; | ||
const res = await fetch(url); | ||
const b = await res.blob(); | ||
const ab = await new Response(b).arrayBuffer(); | ||
let t = await WORKER.table(ab); | ||
window.message.textContent = ""; | ||
return t; | ||
} | ||
|
||
window.addEventListener("load", async () => { | ||
let main = createMainTable(); | ||
let layout = await (await fetch("./layout.json")).json(); | ||
let decks = await (await fetch("./decks.json")).json(); | ||
let names = Object.keys(decks); | ||
for (let name of names) { | ||
const opt = document.createElement("option"); | ||
opt.value = opt.textContent = name; | ||
window.deck_selector.appendChild(opt); | ||
} | ||
window.deck_selector.addEventListener("change", async () => { | ||
// swap the underlying table in the workspace. | ||
window.workspace.tables.set( | ||
"deck", | ||
getDeckTable(window.deck_selector.value, decks) | ||
); | ||
// window.workspace.innerHTML = ""; | ||
}); | ||
main = await main; | ||
DECKS["__mainLibrary"] = main; | ||
window.workspace.tables.set("deck", getDeckTable(names[0], decks)); | ||
await window.workspace.restore(layout); | ||
|
||
await window.workspace.restore(decks[names[0]]); | ||
}); |
Oops, something went wrong.