2.3.0 • Published 6 months ago

@datasqrl/dag-visualization v2.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
6 months ago

DAG Visualization

JS package for visualizing the DAG plan produced by SQRL

Usage

Plain JS

Load script and css styles to your file. Then use DAGVisualization.renderGraph method to initialize a graph in selected DOM node.

<head>
  <title>DataSQRL Deployment Graph Visualization</title>
  <script src="https://www.unpkg.com/@datasqrl/dag-visualization@latest/dist/umd/index.js"></script>
  <link
    rel="stylesheet"
    href="https://www.unpkg.com/@datasqrl/dag-visualization@latest/dist/index.css"
  />
</head>
<body>
  <div id="graph"></div>
  <script>
    const elements = [...];
    DAGVisualization.renderGraph(
      document.getElementById("graph"),
      elements
    );
  </script>
</body>

React

Install @datasqrl/dag-visualization package and render <Graph/> with nodes and edges passed as props.

You need to transform input elements array additionally if it has the same format as in Plain JS example.

import { Graph } from '@datasqrl/dag-visualization';

const elements = [...];
const nodes = elements.map(function (node) {
  return { data: node };
});

const edges = elements.flatMap((node) =>
  (node?.inputs || []).map((input) => ({
    data: { source: input, target: node?.id },
  })),
);
return <Graph elements={{ nodes, edges }} />;

Data format

The elements array presented in usage examples should contain a list of nodes with the following properties:

  • id: string - Unique identifier of the node.
  • inputs: string[] - List of node ID's that are connected to the current node.
  • name: string[] - Node's name (displayed on the graph).
  • type: string - Node's type. Defines node appearance and additional properties.
  • stage: string - Node's stage.
  • plan: string - Node's Physical plan.
  • schema: { name: string, type: string }[] - The list of fields in Node's Schema. Required for the following node types: stream, state, relation.
  • primary_key: string[] - The list of field names that are primary keys in schema.
  • timestamp: string - The name of a timestamp field in schema.
2.3.0

6 months ago

2.2.1

11 months ago

2.0.3

11 months ago

2.2.0

11 months ago

2.1.1

11 months ago

2.0.2

11 months ago

2.2.3

11 months ago

2.0.5

11 months ago

2.2.2

11 months ago

2.0.4

11 months ago

2.2.5

11 months ago

2.2.4

11 months ago

2.2.6

11 months ago

2.1.0

11 months ago

2.0.1

12 months ago

2.0.0

12 months ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago