Skip to content

Instantly share code, notes, and snippets.

@sc1f
Last active July 28, 2020 22:06
Show Gist options
  • Save sc1f/79e27fbcfc94010d657fc2fdcb652fa6 to your computer and use it in GitHub Desktop.
Save sc1f/79e27fbcfc94010d657fc2fdcb652fa6 to your computer and use it in GitHub Desktop.
Editable Perspective
<!--
Copyright (c) 2017, the Perspective Authors.
This file is part of the Perspective library, distributed under the terms of
the Apache License 2.0. The full license can be found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<script src="https://unpkg.com/@finos/perspective-viewer"></script>
<script src="https://unpkg.com/@finos/perspective-viewer-hypergrid"></script>
<script src="https://unpkg.com/@finos/perspective-viewer-d3fc"></script>
<script src="https://cdn.jsdelivr.net/npm/@finos/perspective"></script>
<style>
perspective-viewer {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
</style>
<link rel='stylesheet' href="https://unpkg.com/@finos/perspective-viewer/dist/umd/material.css" is="custom-style">
</head>
<body>
<perspective-viewer editable>
</perspective-viewer>
<script>
const WORKER = window.perspective.worker();
function on_load() {
var el = document.getElementsByTagName('perspective-viewer')[0];
const table = WORKER.table(this.response);
el.load(table);
el.toggleConfig();
}
window.addEventListener('WebComponentsReady', function() {
var xhr = new XMLHttpRequest();
xhr.open('GET', 'https://unpkg.com/@jpmorganchase/perspective-examples/build/superstore.arrow', true);
xhr.responseType = "arraybuffer"
xhr.onload = on_load.bind(xhr);
xhr.send(null);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment