Published
Edited
May 10, 2019
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
viewer = html `
<div style="height: 600px">
<perspective-viewer view="grid">
</perspective-viewer>
</div>
`
Insert cell
Insert cell
Insert cell
viewerLoad = window.addEventListener('WebComponentsReady', function() {
console.log('WebComponentsReady: loading plugins...');
loadPerspectiveViewerPlugins();
})
Insert cell
async function loadPerspectiveViewerPlugins() {
console.log('loadPerspectiveViewerPlugins: loading plugins...');
const hyperGrid = await require('@finos/perspective-viewer-hypergrid@0.3.0-rc.1/build/hypergrid.plugin.js');
const highCharts = await require('@finos/perspective-viewer-highcharts@0.3.0-rc.1/build/highcharts.plugin.js');
}
Insert cell
Insert cell
loadData(dataFile)
Insert cell
function loadData(file) {
const fileReader = new FileReader();
fileReader.onload = function(fileLoadedEvent) {
console.log('loadData: loading file:', file.name);
const textData = fileLoadedEvent.target.result;
const viewer = document.getElementsByTagName('perspective-viewer')[0];
viewer.reset();
viewer.load(textData);
viewer.update(textData);
viewer.toggleConfig();
};
// read csv data file as text to trigger file onLoad event
fileReader.readAsText(file);
}
Insert cell
Insert cell
import {file} from '@jashkenas/inputs'
Insert cell
perspective = require('@finos/perspective@0.3.0-rc.1/build/perspective.js')
Insert cell
perspectiveViewer = require('@finos/perspective-viewer@0.3.0-rc.1/build/perspective.view.js')
Insert cell
Insert cell
viewerStyle = html`
<link rel='stylesheet' href="https://unpkg.com/@finos/perspective-viewer@0.3.0-rc.1/build/material.css" is="custom-style" />
<style>
perspective-viewer {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
</style>
`
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more