-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathindex.js
More file actions
55 lines (48 loc) · 1.87 KB
/
index.js
File metadata and controls
55 lines (48 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/******************************************************************************
*
* Copyright (c) 2018, 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.
*
*/
import perspective from "@finos/perspective";
import "@finos/perspective-viewer-datagrid";
import "@finos/perspective-viewer-d3fc";
import "@finos/perspective-workspace";
import "./index.less";
window.addEventListener("DOMContentLoaded", async () => {
const websocket = perspective.websocket("ws://localhost:8081");
const worker = perspective.shared_worker();
const server_table = websocket.open_table("securities_table");
const table = await worker.table(await server_table.view(), {limit: 10000});
const workspace = document.createElement("perspective-workspace");
document.body.appendChild(workspace);
workspace.tables.set("securities", table);
workspace.restore({
detail: {
main: {
type: "split-area",
orientation: "horizontal",
children: [
{
type: "tab-area",
widgets: ["One"],
currentIndex: 0
},
{
type: "tab-area",
widgets: ["Two"],
currentIndex: 0
}
],
sizes: [0.5, 0.5]
}
},
viewers: {
One: {table: "securities", name: "Heat Map", plugin: "heatmap", "row-pivots": ["client"], columns: ["chg"], "column-pivots": '["name"]'},
Two: {table: "securities", name: "Bar Chart", plugin: "x_bar", "row-pivots": ["client"], columns: ["chg"]}
}
});
window.workspace = workspace;
});