0.2.1 • Published 8 months ago

thgraph v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

thgraph

mxgraph is a popular JavaScript library for creating interactive graphs , and it used by many popular tools like draw.io, but it is no longer maintained. mxgraph not support modern ES module, and it not work with building tools like vite/webpack.

So I want to learn mxgraph source code, and rewrite it with modern ES module, and remove old browser compatibility code. I will try to make it work with vue/react and vite/webpack.

mxgraph-js source code

plan

  • run pass helloworld demo
  • convert to ES Module
  • demos website
  • remove old browser compatibility code
  • using TS refactor code

using

   # install with pnpm 
   pnpm install thgraph

   # build youself
   pnpm build

   # run demos 
   pnpm demos

   # docs
   pnpm docs:dev
  
   # build docs
   pnpm docs:build

documents

A new document for thgraph using vue3 and vite.

new document

helloworld

    // deps
    import { mxGraph ,mxRubberband} from 'thgraph';


     const container = document.getElementById('graphContainer');
    // Creates the graph inside the given container
    const graph = new mxGraph(container);

    // Enables rubberband selection
    new mxRubberband(graph);

    // Gets the default parent for inserting new cells. This
    // is normally the first child of the root (ie. layer 0).
    const parent = graph.getDefaultParent();

    // Adds cells to the model in a single step
    graph.getModel().beginUpdate();
    try {
      const v1 = graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30);
      const v2 = graph.insertVertex(parent, null, 'World!', 200, 150, 80, 30);
      const e1 = graph.insertEdge(parent, null, '', v1, v2);
    } finally {
      // Updates the display
      graph.getModel().endUpdate();
    }

Your also can see the old mxgraph-js document for more details.

mxgraph-js document

0.1.0

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago