All Projects β†’ graphql-editor β†’ Diagram

graphql-editor / Diagram

Licence: mit
☊ Tool for making node graphs. Inspired by dependency graph. Used mainly for automation services πŸ“ˆ

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Diagram

Diagram Maker
A library to display an interactive editor for any graph-like data.
Stars: ✭ 2,086 (+309.02%)
Mutual labels:  graph, editor, diagram, canvas
Litegraph.js
A graph node engine and editor written in Javascript similar to PD or UDK Blueprints, comes with its own editor in HTML5 Canvas2D. The engine can run client side or server side using Node. It allows to export graphs as JSONs to be included in applications independently.
Stars: ✭ 2,735 (+436.27%)
Mutual labels:  graph, visual, editor
Vworkflows
Flow Visualization Library for JavaFX and VRL-Studio
Stars: ✭ 226 (-55.69%)
Mutual labels:  graph, visual
Clchart
A fast, simple and cross-platform(html5 react-native weex wechat-applet) stock chart library created using canvas.
Stars: ✭ 250 (-50.98%)
Mutual labels:  graph, canvas
ux-charts
Simple, responsive, modern Charts with zero dependencies
Stars: ✭ 22 (-95.69%)
Mutual labels:  canvas, graph
Blocks.js
JavaScript dataflow graph editor
Stars: ✭ 165 (-67.65%)
Mutual labels:  graph, editor
Vue Blocks
Vue2 dataflow graph editor
Stars: ✭ 201 (-60.59%)
Mutual labels:  graph, editor
OrgChart
Organization chart layout library
Stars: ✭ 16 (-96.86%)
Mutual labels:  diagram, visual
G2
πŸ“Š A highly interactive data-driven visualization grammar for statistical charts.
Stars: ✭ 11,020 (+2060.78%)
Mutual labels:  graph, canvas
Heimer
Heimer is a simple cross-platform mind map, diagram, and note-taking tool written in Qt.
Stars: ✭ 380 (-25.49%)
Mutual labels:  editor, diagram
Angular Editor Fabric Js
Drag-and-drop editor based on Fabricjs for Angular.io
Stars: ✭ 295 (-42.16%)
Mutual labels:  editor, canvas
Pixelcraft
A Pixel Art Editor
Stars: ✭ 413 (-19.02%)
Mutual labels:  editor, canvas
Baklavajs
Graph / node editor in the browser using VueJS
Stars: ✭ 157 (-69.22%)
Mutual labels:  graph, editor
Shenzhen Go
Experimental visual Go environment
Stars: ✭ 450 (-11.76%)
Mutual labels:  graph, visual
Xnode
Unity Node Editor: Lets you view and edit node graphs inside Unity
Stars: ✭ 2,077 (+307.25%)
Mutual labels:  graph, editor
Chart.js
Simple HTML5 Charts using the <canvas> tag
Stars: ✭ 55,646 (+10810.98%)
Mutual labels:  graph, canvas
Ontodia
Ontodia data diagraming library
Stars: ✭ 107 (-79.02%)
Mutual labels:  graph, diagram
X6
πŸš€ JavaScript diagramming library that uses SVG and HTML for rendering.
Stars: ✭ 2,686 (+426.67%)
Mutual labels:  graph, diagram
Fediagram
图说前端>>ζ”Άι›†ε„η§ε‰η«―ζŠ€ζœ―ε›Ύθ°± πŸš•πŸš–πŸš—πŸššπŸš›πŸšœ
Stars: ✭ 273 (-46.47%)
Mutual labels:  diagram, canvas
Inframap
Read your tfstate or HCL to generate a graph specific for each provider, showing only the resources that are most important/relevant.
Stars: ✭ 430 (-15.69%)
Mutual labels:  graph, diagram

Graphsource

npm Commitizen friendly npm downloads

Diagram is the tool for displaying node based systems.

This package contains one dependency.

Getting started

Javascript

import { Diagram } from 'graphsource'
class App {
  constructor() {
    const root = document.getElementById("root");
    if (!root) {
      throw new Error("No root html element");
    }
    this.diagram = new Diagram(root, {});
    this.diagram.setNodes([
        {
            "name": "Query",
            "type": "type",
            "id": "1",
            "description": "",
            "inputs": [
                "2"
            ],
            "outputs": [],
            "options": [
                "query"
            ]
        },
        {
            "name": "pizzas",
            "type": "Pizza",
            "id": "2",
            "inputs": [],
            "outputs": [
                "2"
            ],
            "description":"get all pizzas a a a from the database",
            "options": [
                "array",
                "required"
            ]
        },
        {
            "name": "Pizza",
            "type": "type",
            "id": "3",
            "description": "Main type of the schema",
            "inputs": [
                "4",
            ],
            "outputs": [],
            "options": []
        },
        {
            "name": "name",
            "type": "String",
            "id": "4",
            "inputs": [],
            "outputs": [
                "3"
            ],
            "options": [
                "required"
            ]
        }
    ])
  }
}
new App()

TypeScript

import { Diagram, NodeDefinition, AcceptedNodeDefinition } from 'graphsource'
this.diagram = new Diagram(document.getElementById("root"));
this.diagram.setNodes
]);

Light mode

Diagram is in dark mode by defult, but You can easily change the theme to light one. Just add the options while creating Diagram.

import { Diagram, DefaultDiagramThemeLight } from 'graphsource'
this.diagram = new Diagram(document.getElementById("root"),
{
  theme: DefaultDiagramThemeLight
});

Develop & Contribute

$ git clone https://github.com/graphql-editor/diagram
$ npm install
$ npm run start

Add to your project

$ npm install graphsource

Listening to diagram events

It's possible to attach to certain events that occur inside the diagram. You can do it by using familiar .on() syntax, e.g.:

this.diagram = new Diagram(/* ... */);
/* ... */
this.diagram.on(EVENT_NAME, () => {
  // callback
});

Here is the list of all subscribable events:

  • ViewModelChanged - fires when a view model (pan, zoom) was changed
  • NodeMoving - fires when node is being moved
  • NodeMoved - fires when node stops being moved
  • NodeSelected - fires when node(s) was selected
  • UndoRequested - fires when undo was requested
  • RedoRequested - fires when redo was requested

You can unsubscribe your listener either by using .off(), or by invoking unsubscriber function that is being returned from .on():

this.diagram = new Diagram(/* ... */);
const callback = (nodeList) => {
  console.log('Nodes are moving!', nodeList);
};
this.diagram.on('NodeMoving', callback); // callback will be fired
// ...
this.diagram.off('NodeMoving', callback); // callback will not be fired anymore
this.diagram = new Diagram(/* ... */);
const callback = () => {
  console.log('node moving!');
};
const unsubscriber = this.diagram.on('NodeMoving', callback); // callback will be fired
// ...
unsubscriber(); // callback will not be fired anymore

Serialisation of data

const diagram = new Diagram(/* ... */);
const callback = ({nodes, links}) => {
  // Here you receive nodes and links after Serialisation
};
this.diagram.on('DataModelChanged', callback); // callback will be fired

Docs

To generate docs simply type:

npm run docs

Controls

  • Pan - press and hold Left Mouse Button and move mouse
  • Move - press and hold Left Mouse Button on node
  • CLICK ON NODE TYPE - if node is a children of other node it centers view on parent node
  • SHIFT + Left Mouse Button Click - select multiple nodes

Contribute

Feel free to contact us and contribute in graphql editor project. [email protected]

  1. fork this repo
  2. Create your feature branch: git checkout -b feature-name
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Used by

Here is Live Demo of diagram used to create node based graphql system

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].