Git Product home page Git Product logo

org-chart's Introduction

Hierarchical Organization Chart for Angular (4+)

Build Status

The ng2-org-chart component displays heirarchal Organizational Chart.

This is extended version of ng-org-chart with images. Million Credits to ng-org-chart

Table of Contents

Usage

npm i ng2-org-chart -S

Include default styles in your index.html

	<link rel="stylesheet" href="node_modules/ng-org-chart/styles.css">

app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { OrgChartModule } from 'ng2-org-chart';

import { AppComponent } from './app.component';

@NgModule({
    imports: [BrowserModule, OrgChartModule],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }

app.component.html:

<ng-org-chart [topEmployee]="topEmployee"></ng-org-chart>

app.component.ts:

export class AppComponent {
    topEmployee: IEmployee = {
        name: 'Janis Martin',
        designation: 'CEO',
		img: "./assets/data/img/b.JPG",
        subordinates: [
            {
                name: 'Matthew Wikes',
                designation: 'VP',
				img: "./assets/data/img/b.JPG",
                subordinates: [
                    {
                        name: 'Tina Landry',
                        designation: 'Budget Analyst',
                        subordinates: []
                    }

                ]
            },
            {
                name: 'Patricia Lyons',
                designation: 'VP',
				img: "./assets/data/img/c.JPG",
                subordinates: [
                    {
                        name: 'Dylan Wilson',
                        designation: 'Web Manager',
						img: "./assets/data/img/b.JPG",
                        subordinates: []
                    },
                    {
                        name: 'Deb Curtis',
                        designation: 'Art Director',
						img: "./assets/data/img/c.JPG",
                        subordinates: []
                    }
                ]
            },
            {
                name: 'Larry Phung',
                designation: 'VP',
				img: "./assets/data/img/a.JPG",
                subordinates: []
            }
        ]
    };
}

Here is the rendered output:

Sample Organizational Chart

Custom CSS

You can override default styles with your custom CSS. Make sure you include your custom CSS after including the default CSS so that your styles override the default styles.

.oc-border {
	border: 1px solid green;
}

.oc-background {
	background-color: limegreen;
}

.oc-name {
	font-family: Cambria, Cochin, Georgia, Times, Times New Roman, serif;
	white-space: nowrap;
}

.oc-designation {
	font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
	font-style: italic;
	white-space: nowrap;
}

.oc-img {
	margin-left: -10px;
    width: 60px;
    height: 60px;
}

org-chart's People

Contributors

mkarci26 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

org-chart's Issues

IEmployee issue

while using this library with Angular 6 i am getting "error TS2304: Cannot find name 'IEmployee'"
please suggest why this error is coming and also CSS is not getting apply on my page.

TIA

Template parse errors

Hello,

Very good idea with this plugin. I try to install it as for nulldev07 but I have this following error, have you an idea of why ?
Picture
Ps: You forgot a img tag in your topEmployee example.

Thank you. :)

Status of this repo

Hi, I was curious about the status and direction of this repo.

I forked it about a year ago and made a few small visual changes to it but then start adding features to it. My work wouldn't have been possible without your project.

I am looking to do one of 2 things... Either PR/merge my stuff into the main codebase here, or spawn a new npm module based off of it. Depending on what your plans are.

I will say that some of my visual changes may have left what you originally had planned, but I wasn't sure about your plans.

Let me know!

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.