Created
October 19, 2021 11:04
-
-
Save jorgeatgu/b289d0ad98f9d3271d467db91b995714 to your computer and use it in GitHub Desktop.
Perspective datetime
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
license: mit |
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
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | |
<link rel='stylesheet' href="https://unpkg.com/@finos/perspective-workspace/dist/umd/material.dark.css"> | |
<script src="https://unpkg.com/@finos/perspective-workspace/dist/umd/perspective-workspace.js"></script> | |
<script src="https://unpkg.com/@finos/perspective-viewer-datagrid"></script> | |
<script src="https://unpkg.com/@finos/perspective-viewer-d3fc"></script> | |
<script src="https://unpkg.com/@finos/perspective/dist/umd/perspective.js"></script> | |
<script src="index.js"></script> | |
<link rel='stylesheet' href="styles.css"> | |
</head> | |
<body> | |
<perspective-viewer></perspective-viewer> | |
</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
window.addEventListener("load", async () => { | |
const elem = document.getElementsByTagName("perspective-viewer")[0]; | |
const schema = { | |
x: "integer", | |
y: "string", | |
z: "datetime" | |
} | |
const worker = perspective.worker(); | |
const table = await worker.table(schema); | |
elem.load(table) | |
table.update([ | |
{ x: 1, y: "a", z: "2000-01-05 14:24:58.000000"}, | |
{ x: 2, y: "b", z: "2007-05-16 10:12:32.000000"}, | |
{ x: 3, y: "c", z: "2009-11-18 18:12:45.000000"}, | |
{ x: 4, y: "d", z: "2010-05-26 13:29:53.000000" }, | |
{ x: 1, y: "a", z: "2000-01-05 14:24:58"}, | |
{ x: 2, y: "b", z: "2007-05-16 10:12:32"}, | |
{ x: 3, y: "c", z: "2009-11-18 18:12:45"}, | |
{ x: 4, y: "d", z: "2010-05-26 13:29:53" } | |
]); | |
}); |
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
perspective-viewer { | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment