Giter Club home page Giter Club logo

orgchartjs's Introduction

OrgChartJS

Organization Chart with create/edit/move features.

How to install

Just put the css and js files on your folder and call them like:

<link rel="stylesheet" type="text/css" href="../css/OrgChart.css">
<script src="../js/OrgChart.js"></script>

You also need to call jQuery and font-awesome.

How to use

First, you need to create a div with your chart id.

<div id="myOrgChart"></div>

After that, create the OrgChart object

let chart;
window.onload = function () {
     chart = new OrgChart(document.getElementById("myOrgChart"), {
         config: {
             canEdit: true,
             canMove: true,
             canCreate: true,
             height: 500,
             width: 1500,
           heightNode: 50,
           widthNode: 150,
           margin: 15
       },
       nodes: [
           { id: 0, name: "CEO" },
           { id: 1, pid: 0, name: "Manager 1" },
           { id: 2, pid: 0, name: "Manager 2" },
           { id: 3, pid: 0, name: "Manager 3" },
           { id: 4, pid: 1, name: "Supervisor" },
           { id: 5, pid: 4, name: "Developer" },
           { id: 6, pid: 4, name: "Developer" },
           { id: 7, pid: 2, name: "Marketing 1" },
           { id: 8, pid: 2, name: "Marketing 2" },
           { id: 9, pid: 8, name: "Intern 1" },
           { id: 10, pid: 8, name: "Intern 2" },
       ]
   });
};

Customizing your OrgChart

There are some functions you can edit to add more features to your organization chart. In the bottom of the OrgChart.js file, there are functions like:

  • createNode(parentId)
  • editNode(nodeId)

You can add pop-ups or events as you wish to customize the creation and editing of your nodes here.

Dependencies

  • Jquery
  • font-awesome

License

This code is available under MIT license.

orgchartjs's People

Contributors

brenocq avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.