All Projects → playcanvas → pcui-graph

playcanvas / pcui-graph

Licence: MIT license
A JavaScript library for creating node-based graphs

Programming Languages

javascript
184084 projects - #8 most used programming language
SCSS
7915 projects

Projects that are alternatives of or similar to pcui-graph

typescript-playcanvas-template
PlayCanvas TypeScript/WebPack template
Stars: ✭ 27 (-65.38%)
Mutual labels:  playcanvas
playcanvas-webpack
Demonstration of building a PlayCanvas app with Webpack
Stars: ✭ 14 (-82.05%)
Mutual labels:  playcanvas
editor
Issue tracker for the PlayCanvas Editor
Stars: ✭ 77 (-1.28%)
Mutual labels:  playcanvas
awesome-playcanvas
A curated list of awesome PlayCanvas assets, resources, and more.
Stars: ✭ 185 (+137.18%)
Mutual labels:  playcanvas
playcanvas-viewer
glTF 2.0 model viewer
Stars: ✭ 152 (+94.87%)
Mutual labels:  playcanvas
playcanvas-gltf
glTF 2.0 support for the PlayCanvas Engine
Stars: ✭ 97 (+24.36%)
Mutual labels:  playcanvas
playcanvas.github.io
Live examples of the PlayCanvas Engine
Stars: ✭ 71 (-8.97%)
Mutual labels:  playcanvas

PCUI Graph

PCUI Graph

Create node based visual graphs in the browser. Supports undirected / directed graphs as well as visual scripting graphs containing nodes with input / output ports. Your graphs can be saved to a JSON file and loaded back into a new graph view at any time.

Getting Started

To build the graph library, run the following in the root directory.

npm install
npm run build

You can then use the library in your own project by including the dist/index.mjs file. The graph can then be instantiated as follows:

import { Graph } from 'dist/index.mjs';

const schema = {
    nodes: {
        0: {
            name: 'Hello',
            fill: 'red'
        },
        1: {
            name: 'World',
            fill: 'green'
        }
    },
    edges: {
        0: {
            from: [0], // this edge can connect nodes of type 0
            to: [1], // to nodes of type 1,
            stroke: 'blue'
        }
    }
}

const graph = new Graph(schema);
document.body.appendChild(graph.dom);

The library is also available on npm and can be installed in your project with

npm install --save @playcanvas/pcui-graph @playcanvas/pcui @playcanvas/observer

The npm package includes two builds of the library:

@playcanvas/pcui-graph/dist/pcui-graph.js // UMD build (requires that the pcui and observer libraries are present in the global namespace)
@playcanvas/pcui-graph/dist/pcui-graph.mjs // module build (requires a build tool like rollup / webpack)

Storybook

Examples of graphs created using PCUI Graph are available in this library's storybook. Alternatively you can run the storybook locally and use it as a development environment for your own graphs. To do so, run the following commands in this projects root directory:

npm install
npm run storybook

This will automatically open the storybook locally at http://localhost:9009.

Documentation

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].