Skip to content

sj-js/vis-networkman

Repository files navigation

vis-networkman

1. Getting Started

  1. Load

    • Browser
      <script src="https://cdn.jsdelivr.net/gh/sj-js/vis-networkman/vis-network.min.js"></script>
      <script src="https://cdn.jsdelivr.net/gh/sj-js/vis-networkman/vis-networkman.min.js"></script>
      <script>
           var visnetworkman = new VisNetworkMan();
      </script>
    • ES6+
      npm install @sj-js/vis-networkman
      require('@sj-js/vis-networkman/dist/css/vis-networkman.css');
      const VisNetworkMan = require('@sj-js/vis-networkman');
      const visnetworkman = new VisNetworkMan();
  2. Simple Example

    1. Test with null @ ! @
      <body><!-- None --></body>
      <script>        
          var container = visnetworkman.renderWithDataList(null);
          document.body.appendChild(container);
      </script>
    2. Test with simple datas @ ! @
      <body><!-- None --></body>
      <script>        
          var container = visnetworkman.renderWithDataList([
              {id:1, label:'A1', group:0, parentId:null},                       
              {id:2, label:'A2', group:1, parentId:1},
              {id:3, label:'A3', group:2, parentId:2},
              {id:4, label:'A4', group:2, parentId:2},
              {id:5, label:'A5', group:2, parentId:2}
          ]);
          document.body.appendChild(container);
      </script>
    3. Test with test datas @ ! @
      <body><!-- None --></body>
      <script>        
          var container = visnetworkman.renderWithDataList( VisNetworkMan.loadTestDataList() );
          document.body.appendChild(container);
      </script>

2. Functions

2-1. .setup({ ... })

  • VIS Network의 Options값을 설정합니다. (참조: https://visjs.github.io/vis-network/docs/network/)
  • 가장 기본값으로 적용되며 다른 Event에 의해 변경될 수 있습니다.
    visnetworkman.setup({
        nodes:{ /** REF: https://visjs.github.io/vis-network/docs/network/nodes.html# **/
            shape:'circle',
        },
        edges:{ /** REF: https://visjs.github.io/vis-network/docs/network/edges.html# **/
            width:5,
            arrows:{from: false, middle: false, to: false}
        },            
    });    

2-2. .setupExtendsOption({ ... })

  • VIS NetworkMan의 Options값을 설정합니다.
    visnetworkman.setupExtendsOption({
        modePointAllSubLink: true,
        modeSelectAllSubLink: true,
        ...
    });    

2-3. .renderWithDataList([ {...}, ... ])

  • Data기준의 Object Array로 Rendering합니다.
    var container = visnetworkman.renderWithDataList([
    ]);
    document.body.appendChild(container);

2-4 .renderWithNodeDataList([ {...}, ... ])

  • Node기준의 Object Array로 Rendering합니다.
    var container = visnetworkman.renderWithNodeDataList([
    ]);
    document.body.appendChild(container);

Releases

No releases published

Packages

No packages published