Skip to content

Instantly share code, notes, and snippets.

@JHawk
Last active July 15, 2019 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JHawk/b29192cd425bfc9443dd12626cc2f606 to your computer and use it in GitHub Desktop.
Save JHawk/b29192cd425bfc9443dd12626cc2f606 to your computer and use it in GitHub Desktop.
Perspective Superstore Arrow Example
license: apache-2.0

A static superstore.arrow demo.

const ARROW = "https://unpkg.com/@jpmorganchase/perspective-examples/build/superstore.arrow";
window.addEventListener('WebComponentsReady', function() {
// Fetch and load arrow data.
var xhr = new XMLHttpRequest();
xhr.open('GET', ARROW, true);
xhr.responseType = "arraybuffer"
xhr.onload = function() {
// Get element from the DOM.
var el = document.getElementsByTagName('perspective-viewer')[0];
// Load the arrow response in the `<perspective-viewer>` DOM reference.
el.load(xhr.response);
// Toggle the config controls open.
el.toggleConfig();
}
xhr.send(null);
});
perspective-viewer {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
<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/build/perspective.js"></script>
<script src="https://unpkg.com/@finos/perspective-viewer/build/perspective.view.js"></script>
<script src="https://unpkg.com/@finos/perspective-viewer-hypergrid/build/hypergrid.plugin.js"></script>
<script src="https://unpkg.com/@finos/perspective-viewer-d3fc/build/d3fc.plugin.js"></script>
<script src="arrow.js"></script>
<link rel='stylesheet' href="https://unpkg.com/@finos/perspective-viewer/build/material.css" is="custom-style">
<link rel='stylesheet' href="index.css">
</head>
<body>
<perspective-viewer view="d3_sunburst" row-pivots='["Sub-Category","Region","Segment"]' sort='[["Profit","desc"]]' columns='["Sales", "Profit"]'>
</perspective-viewer>
</body>
</html>
This file has been truncated, but you can view the full file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment