npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

org-chart-22

v1.0.2

Published

An Angular 2+ library for displaying Organization charts. It's a very lightweigt library with the features currently not available in any other library. It's written in pure typescript and is developed focussing on Angular projects

Downloads

3

Readme

Angular Org Chart

An Angular 2+ library for displaying Organization charts. It's a very lightweigt library with the features currently not available in any other library. It's written in pure typescript and is developed focussing on Angular projects

Getting Started

For using the chart, you'll need to do the folloing steps:

Installation

npm install angular-org-chart --save

Add the dependency in module

Add 'OrgChartModule' in imports

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { OrgChartModule } from 'angular-org-chart';
import { AppComponent } from './app.component';

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

Formatting the data in component

The data requires few parameters for displaying the correct chart:

{
      name: "Element Value",
      type: 'Element Type',
      children:[]
}

Example component

import { Component } from '@angular/core';
import { OrgData } from 'angular-org-chart/src/app/modules/org-chart/orgData';


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  orgData: OrgData= {
    name: "Iron Man",
    type: 'CEO',
    children: [
		{
			name: "Captain America",
			type: 'VP',
			children: [
				{
					name: "Hawkeye",
					type: 'manager',
					children: []
				},
				{
					name: "Antman",
					type: 'Manager',
					children: []
				}
			]
		},
		{
			name: "Black Widow",
			type: 'VP',
			children: [
				{
					name: "Hulk",
					type: 'manager',
					children: [
						{
							name: "Spiderman",
							type: 'Intern',
							children: []
						}
					]
				},
				{
					name: "Thor",
					type: 'Manager',
					children: [
						{
							name: "Loki",
							type: 'Team Lead',
							children: []
						}
					]
				}
			]
		}
	]
  };
}

Using the org chart in HTML template

<angular-org-chart id="orgChartId" [data]="orgData"></angular-org-chart>

Pleaase note that 'id' is required if you want to change the css. As the style which you'll need to give for the boxes and the lines, you'll be required to add it on the basis of 'id' else the css won't be applied.

Personalized CSS

Use the 'id' and place these css: For Lines:

#orgChartId .org-chart-entity-border {
	border-left: 1px solid green;
	border-top: 1px solid green;
}

For Distance between the levels:

#orgChartId .org-chart-entity-connector {
	height: 2em;
}

For box styles:

#orgChartId .org-chart-entity-box {
	align-items: center;
    border: 1px solid blue;
    background-color: blue;
    border-radius: 3px;
	box-shadow: 0 .5rem 1rem #777!important;
}

Example

enter image description here

Features

  • Expand/Collapse on clilck
  • Custom Styles
  • Maintained and lightweight code

Upcoming features

  • Feature to turn off default expand/collapse on click.
  • Icon support.
  • More freedom of custom styles.
  • Expand / Collapse all feature.

Authors

  • Shrey Kumar Jain - Initial work - Blog