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

cm-angular-org-chart

v3.0.0

Published

Hierarchical Organizational Chart for Angular

Downloads

203

Readme

Hierarchical Organization Chart for Angular v14, v15 and v16 versions

The cm-angular-org-chart component displays heirarchal Organizational Chart.

Please install latest version for Error free.

Org Chart

Table of Contents

Version

| Angular | cm-angular-org-chart | |---|---| |16|3.0.0| |15|2.0.0| |14|1.1.3|

Usage

Each employee is represented by an object with the following properties. Note that all the properties are optional.

| Property | Type| Description | |---|---|---| |name|string| The name of the employee | |cssClass|string| The CSS class to apply to the employee block| |imageUrl|string| URL to the employee's image |designation|string| Employee's designation |subordinates|Employee[]| An array of subordinate employees

Installation

$ npm i cm-angular-org-chart

app.module.ts

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

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    CmAngularOrgChartModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

app.component.html:

  <org-chart [topEmployee]="topEmployee" direction="vertical"></org-chart>

app.component.ts:

export class AppComponent {
  employeeImage = "assets/employee.png";
  topEmployee: any = {
    name: 'Sundar Pichai',
    cssClass: 'oc-superSenior',
    imageUrl: this.employeeImage,
    designation: 'Chief Executive Officer',
    subordinates: [
      {
        name: 'Thomas Kurian',
        cssClass: 'oc-senior',
        imageUrl: this.employeeImage,
        designation: 'CEO, Google Cloud',
      },
      {
        name: 'Susan Wojcicki',
        cssClass: 'oc-senior',
        imageUrl: this.employeeImage,
        designation: 'CEO, YouTube',
        subordinates: [
          {
            name: 'Beau Avril',
            cssClass: 'oc-me',
            imageUrl: this.employeeImage,
            designation: 'Global Head of Business Operations',
            subordinates: []
          },
          {
            name: 'Tara Walpert Levy',
            cssClass: 'oc-me',
            imageUrl: this.employeeImage,
            designation: 'VP, Agency and Brand Solutions',
            subordinates: [
              {
                name: 'Junior 1 David',
                cssClass: 'oc-junior',
                imageUrl: this.employeeImage,
                designation: 'CEO, Google Health',
                subordinates: []
              },
              {
                name: 'Junior 2 David',
                cssClass: 'oc-junior',
                imageUrl: this.employeeImage,
                designation: 'CEO, Google Health',
                subordinates: [
                  {
                    name: 'superJunior 1 David',
                    cssClass: 'oc-superJunior',
                    imageUrl: this.employeeImage,
                    designation: 'CEO, Google Health',
                    subordinates: []
                  },
                  {
                    name: 'superJunior 2 David',
                    cssClass: 'oc-superJunior',
                    imageUrl: this.employeeImage,
                    designation: 'CEO, Google Health',
                    subordinates: []
                  }
                ]
              }
            ]
          },
        ]
      },
      {
        name: 'Jeff Dean',
        cssClass: 'oc-senior',
        imageUrl: this.employeeImage,
        designation: 'Head of Artificial Intelligence',
        subordinates: [
          {
            name: 'David Feinberg (You)',
            cssClass: 'oc-me',
            imageUrl: this.employeeImage,
            designation: 'CEO, Google Health',
            subordinates: []
          }
        ]
      }
    ]
  };
}

Inputs

| Name | Type | Description |---|---|---| |topEmployee| Employee object| The Employe object mentioned above |direction| vertical or horizontal | Renders chart vertically or horizontally

Outputs

|Name |Parameters | Description |---|---|---| |itemClick|Employee| The Employee object which was clicked

Ex: <org-chart [topEmployee]="topEmployee" direction="vertical" (itemClick)="onClickItem($event)">

Default Look

Horizontal

Horizontal Chart

Vertical

Vertical Chart

Custom Styling

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

.oc-name {
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
}

.oc-designation {
  font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
}

.oc-border {
  border-color: #9E9E9E;
}

.oc-box {
  color: white;
  width: 10em;
}

// Custom cssClass from Employee object
.oc-superSenior {
	background-color: midnightblue;
}

.oc-senior {
	background-color: brown;
}

.oc-me {
	background-color: darkgreen;
}

.oc-junior {
	background-color: darkgoldenrod;
}

.oc-superJunior {
	background-color: purple;
    }

License

MIT

Author