How to use the @finos/perspective.websocket function in @finos/perspective

To help you get started, we’ve selected a few @finos/perspective examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github timkpaine / aat / js / src / ts / index.ts View on Github external
const main = async () => {
  const tradesViewer = document.createElement("perspective-viewer");
  await tradesViewer.restore({
    plugin: "datagrid",
    sort: [["timestamp", "asc"]],
  });

  const ordersViewer = document.createElement("perspective-viewer");
  await ordersViewer.restore({
    "column-pivots": ["side"],
    "plugin": "datagrid",
    "sort": [["price", "desc"]],
  });

  // connect to perspective
  const websocket = perspective.websocket("ws://localhost:8080/api/v1/ws");

  const tradesTable = websocket.open_table("trades");
  const ordersTable = websocket.open_table("orders");

  // perspective workspace
  // const workspace = new PerspectiveWorkspace();
  // workspace.addClass("workspace");
  // workspace.title.label = "AAT";
  const workspace = new DockPanel();
  workspace.addClass("workspace");

  // const tradesWidget = new PerspectiveViewerWidget("Trades");
  // const ordersWidget = new PerspectiveViewerWidget("Orders");

  // Add tables to workspace
  const tradesWidget = new Widget({node: tradesViewer});
github finos / perspective / python / perspective / examples / python-phosphor / src / js / index.js View on Github external
window.addEventListener("load", async () => {
    // Create a client that expects a Perspective server to accept connections at the specified URL.
    const websocket = perspective.websocket("ws://localhost:3001/websocket");
    //const worker = perspective.worker();
    //worker.initialize_profile_thread();

    //const view = websocket.open_view("data_source_one");

    // Table created in JS from datafeed in python
    const table = websocket.open_table("data_source_one");
    const workspace = new PerspectiveWorkspace();

    const widget1 = new PerspectiveWidget("Spread", {
        editable: true,
        plugin: "d3_y_line",
        "row-pivots": ["client"],
        "column-pivots": ["name"],
        columns: ["spread"],
        aggregates: {