Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* 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.
*
*/
import perspective from "@finos/perspective";
import {PerspectiveWorkspace, PerspectiveWidget} from "@finos/perspective-phosphor";
import {Widget} from "@phosphor/widgets";
import "@finos/perspective-phosphor/src/theme/material/index.less";
import "@finos/perspective-viewer-hypergrid";
import "@finos/perspective-viewer-d3fc";
import "./index.less";
const worker = perspective.shared_worker();
const req = fetch("./superstore.arrow");
window.addEventListener("load", async () => {
const resp = await req;
const buffer = await resp.arrayBuffer();
const table = worker.table(buffer);
const workspace = new PerspectiveWorkspace();
const widget1 = new PerspectiveWidget("One", {
"row-pivots": ["Sub-Category"],
columns: ["Profit", "Sales"]
});
const widget2 = new PerspectiveWidget("Two", {
plugin: "d3_x_bar",
_get_worker() {
if (this._table) {
return this._table._worker;
}
return perspective.shared_worker();
}
}