1.1.0 • Published 4 years ago

family-hierarchy v1.1.0

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

FamilyHierarchy

A small library for Angular 9+ that implements vis-network to generate a hierarchy chart of a family.

Example FamilyHierarchy

Pre-requisites

Demo

We use ngx-vis, to generate the graph, and so we have to install some dependencies:

npm install moment @egjs/hammerjs vis-data vis-util keycharm

Installation

Just add the FamilyHierarchy for use the component

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

@NgModule({
 imports: [
  (...)
  FamilyHierarchy,
  (...)
 ],
 declarations: [AppComponent],
})

Example

<FamilyHierarchy
  [config]="config"
  [links]="links"
  [nodes]="nodes"
  [unions]="unions"
  (selected)="nodeSelected($event)">
</FamilyHierarchy>

Documentation

Configuration

export const DEFAULT_CONFIG: FhConfig = {
  links: {
    childrens: {
     styles : {
      color: '#848484',
      highlight: '#848484',
      hover: '#848484'
     }
    },
    parents: {
      styles: {
        color: '#99004d',
        highlight: '#800040',
        hover: '#800040',
      }
    }
  },
  nodes : {
    images: DEFAULT_NODE_IMAGE,
    size: 20
  },
  union: {
    images: DEFAULT_UNION_IMAGE,
    size: 20
  }
}

Nodes

export interface FhNode {
  id: any;
  label: string;
  level: number;
  image?: string;
  data?: any;
  color ?: {};
}

Links

export interface FhLink {
  unionId: any;
  nodeId: any;
}

Unions

export interface FhUnion {
  id: any;
  components: any [];
  image?: string;
  data?: any;
}

Errors

If there is an error with moment, it can be fixed by adding the following to the compile options in tsconfig.app

(...)
"compilerOptions": {
  (...)
  "allowSyntheticDefaultImports": true,
}
(...)
1.1.0

4 years ago

1.0.0

4 years ago

0.5.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago