Options
All
  • Public
  • Public/Protected
  • All
Menu
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OrgChartJS</title>
<style>
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; font-family: Helvetica; }
#tree { width: 100%; height: 100%; }
</style>
</head>
<body>
<script src="https://cdn.balkan.app/orgchart.js"></script>
<div id="tree"></div>
<script>
let chart = new OrgChart(document.getElementById("tree"), {
mouseScrool: OrgChart.action.scroll,
enableDragDrop: true,
nodeBinding: { field_0: "name" },
nodes: [
{ id: 1, name: "Amber McKenzie" },
{ id: 2, pid: 1, name: "Ava Field" },
{ id: 3, pid: 1, name: "Peter Stevens" }
]
});
</script>
</body>
</html>

Hierarchy

Index

Constructors

Properties

Accessors

Methods Event Listeners

Methods Other

Constructors

  • new OrgChart(element?: null | string | HTMLElement, options?: options): OrgChart
  • let chart = new OrgChart('#tree', {});
    

    Parameters

    • Optional element: null | string | HTMLElement

      HTML element or string selector for example '#tree'

    • Optional options: options

      configuration options

    Returns OrgChart

Properties

aiUI: aiUI

The chart aiUI object.

let chart = new OrgChart('#tree', {});
let aiUI = chart.aiUI;
config: options

The chart config object.

let chart = new OrgChart('#tree', {});
let config = chart.config;
controlsUI: controlsUI

The chart controlsUI object.

let chart = new OrgChart('#tree', {});
let controlsUI = chart.controlsUI;
editUI: editUI

The chart editUI object.

let chart = new OrgChart('#tree', {});
let editUI = chart.editUI;
element: HTMLElement

The tree div element.

let chart = new OrgChart('#tree', {});
let element = chart.element;
filterUI: filterUI

The chart filterUI object.

let chart = new OrgChart('#tree', {});
let filterUI = chart.filterUI;
isVisible: boolean

Returns true if chart is visible

let chart = new OrgChart('#tree', {});
chart.onInit(() => {
console.log(chart.isVisible);
});
chart.load(nodes)
mainElement: HTMLElement

The tree div element.

let chart = new OrgChart('#tree', {});
let mainElement = chart.mainElement;
menuUI: menuUI

The chart menuUI object.

let chart = new OrgChart('#tree', {});
let menuUI = chart.menuUI;
nodeCircleMenuUI: circleMenuUI

The chart nodeCircleMenuUI object.

let chart = new OrgChart('#tree', {});
let nodeCircleMenuUI = chart.nodeCircleMenuUI;
nodeContextMenuUI: menuUI

The chart nodeContextMenuUI object.

let chart = new OrgChart('#tree', {});
let nodeContextMenuUI = chart.nodeContextMenuUI;
nodeMenuUI: menuUI

The chart nodeMenuUI object.

let chart = new OrgChart('#tree', {});
let nodeMenuUI = chart.nodeMenuUI;
nodes: {}

All chart nodes

let chart = new OrgChart('#tree', {});
chart.onInit(() => {
let nodes = chart.nodes;
});
chart.load(nodes)

Type declaration

    orgScribeUI: orgScribeUI

    The chart orgScribeUI object.

    let chart = new OrgChart('#tree', {});
    let orgScribeUI = chart.orgScribeUI;
    pdfPreviewUI: pdfPreviewUI
    pngPreviewUI: pngPreviewUI
    powerPointPreviewUI: powerPointPreviewUI
    roots: node[]

    All root nodes in the chart

    let chart = new OrgChart('#tree', {});
    chart.onInit(() => {
    let roots = chart.roots
    });
    chart.load(nodes)
    searchUI: searchUI

    The chart searchUI object.

    let chart = new OrgChart('#tree', {});
    let searchUI = chart.searchUI;
    svgPreviewUI: pngPreviewUI
    toolbarUI: toolbarUI

    The chart toolbarUI object.

    let chart = new OrgChart('#tree', {});
    let toolbarUI = chart.toolbarUI;
    undoRedoUI: undoRedoUI

    The chart undoRedoUI object.

    let chart = new OrgChart('#tree', {});
    let undoRedoUI = chart.undoRedoUI;
    visibleNodeIds: (string | number)[]

    Returns the visible nodes ids

    let chart = new OrgChart('#tree', {});
    chart.onInit(() => {
    console.log(chart.visibleNodeIds);
    });
    chart.load(nodes)
    AI_SYSTEM_MESSAGES: string[]

    System instructions let you steer the behavior of a model based on your specific needs and use cases.

    OrgChart.AI_SYSTEM_MESSAGES = ["You are an HR assistant for interactive Organizational Char in MyCompamyName."];
    
    CLINK_CURVE: number

    Set the clink curve value set to 0 for a straight clicnk

    OrgChart.CLINK_CURVE = 1.5;
    
    CONVERT_IMAGES_TO_BASE64_BEFORE_EXPORT: boolean

    Whether to embed external images as Base64 data URIs. Enabling this ensures the SVG is "standalone" and won't have broken image links when shared or viewed offline.

    CSV_DELIMITER: string

    Csv import and export delimiter/separator

    OrgChart.CSV_DELIMITER = ',';
    
    EDITFORM_CLOSE_BTN: string

    Edit Form close button

    OrgChart.EDITFORM_CLOSE_BTN = '<div data-edit-from-close style="text-align:right; font-size: 34px; padding: 7px 7px 0 0; cursor: pointer;">X</div>';
    
    ESCAPE_HTML: boolean

    Escape HTML to prevent Cross-site scripting (also known as XSS) attacks

    OrgChart.ESCAPE_HTML = true; // the default value is false
    
    EXPORT_PAGES_CUT_NODES: boolean

    Cut nodes when export with pages, dafault is false

    OrgChart.EXPORT_PAGES_CUT_NODES = true;
    
    FILTER_ALPHABETICALLY: boolean

    Filter menu is ordered alphabetically by default

    OrgChart.FILTER_ALPHABETICALLY = false;
    
    IT_IS_LONELY_HERE_LINK: string

    The text that we have if the chart is empty.

    OrgChart.IT_IS_LONELY_HERE_LINK = "Click here to add your first node"
    
    LAZY_LOADING: boolean

    Can be used to instruct the browser to defer loading of OrgChart that are off-screen until the user scrolls near them. The init event listener will be called as soon as the OrgChart become visible. Default value: true

    OrgChart.LAZY_LOADING = false;
    
    LAZY_LOADING_FACTOR: string | number

    Determines when the invisible nodes will become visible. The number tells on how many free pixel to show nodes The defaul value is auto

    OrgChart.LAZY_LOADING_FACTOR = 10;
    
    LINK_ROUNDED_CORNERS: number

    Set the radius of the roundet links

    OrgChart.LINK_ROUNDED_CORNERS = 20;
    
    MINIMUM_SYMBOLS_IN_SEARCH_INPUT: number

    Minimum in search input before triggering the search.

    OrgChart.MINIMUM_SYMBOLS_IN_SEARCH_INPUT = 3;
    
    MIXED_LAYOUT_ALL_NODES: boolean

    If false arrange vertically the nodes wothout children Default value: true

    OrgChart.MIXED_LAYOUT_ALL_NODES = false;
    
    MIXED_LAYOUT_FOR_NODES_WITH_COLLAPSED_CHILDREN: boolean

    Set mixed layout if there are collapsed children Defaul value: false

    OrgChart.MIXED_LAYOUT_FOR_NODES_WITH_COLLAPSED_CHILDREN = true;
    
    MIXED_LAYOUT_IF_NUMBER_OF_CHILDREN_IS_MORE_THEN: number

    Use mixed layout for example tree or treeLeftOffset if number of children is more then specified value Default value: 1

    OrgChart.MIXED_LAYOUT_IF_NUMBER_OF_CHILDREN_IS_MORE_THEN = 0;
    
    ORGSCRIBE_OFFSET: string[]

    A string used for indentation of child nodes. Each tree level increases the indentation by one repetition of this string. Example: if offset = " ", then level 1 children are indented by " ", level 2 by " ", and so on.

    OrgChart.ORGSCRIBE_OFFSET = '-';
    
    RENDER_CLINKS_BEFORE_NODES: boolean

    Render clinks before nodes, default is false

    OrgChart.RENDER_CLINKS_BEFORE_NODES = true;
    
    RENDER_LINKS_BEFORE_NODES: boolean

    Render links before nodes, default is false

    OrgChart.RENDER_LINKS_BEFORE_NODES = true;
    
    REQUEST_CUSTOM_HEADERS: {}

    A dictionary of custom HTTP headers that will be sent with all server-side JavaScript requests executed by the library.

    Each key represents the header name and the value represents the header value.

    Example:

    OrgChart.REQUEST_CUSTOM_HEADERS = {
    "My-Access-Key": "Expected-Key",
    "X-Tenant-Id": "my-tenant"
    };

    This is typically used when the server requires authentication, multi-tenant identification, or other contextual headers.

    Type declaration

    • [key: string]: string
    RESET_MOVABLE_ONEXPANDCOLLAPSE: boolean

    Reset movable nodes to its original position when expand or collapse Works with movable nodes functionality

    OrgChart.RESET_MOVABLE_ONEXPANDCOLLAPSE = true;
    
    SEARCH_CLOSE_RESULT_ON_ESCAPE_OR_CLICKOUTSIDE: boolean

    Close search result list by click outside list and clean search input

    OrgChart.SEARCH_CLOSE_RESULT_ON_ESCAPE_OR_CLICKOUTSIDE = true; // default value is false
    
    SEARCH_HELP_SYMBOL: string

    Search help symbol.

    OrgChart.SEARCH_HELP_SYMBOL = "help";
    
    SEARCH_PLACEHOLDER: string

    Search placeholder

    OrgChart.SEARCH_PLACEHOLDER = "Chercher"; // the default value is "Search"
    
    SEARCH_RESULT_LIMIT: number

    Set the limit of the search result items

    OrgChart.SEARCH_RESULT_LIMIT = 5;
    
    SLINK_GAP: number

    Gap between slinks in pixels

    TREELIST_SCROLLBAR_WIDTH: number

    Scrollbar width (in pixels) for the TreeList layout.

    TREELIST_WHEEL_STEP: string

    Mouse wheel scroll step (in pixels) for the TreeList layout. Controls vertical scroll speed in OrgChart.layout.treeList. Larger values scroll faster; smaller values scroll slower. Default: half of the first TreeList item height.

    VERSION: string

    OrgChart version

    OrgChart.VERSION;
    
    VERTICAL_CHILDREN_ASSISTANT: boolean

    Align children of assistant vertically

    OrgChart.VERTICAL_CHILDREN_ASSISTANT = true;
    
    clinkTemplates: {}
    OrgChart.clinkTemplates.myTemplate = Object.assign({}, OrgChart.clinkTemplates.orange);
    OrgChart.clinkTemplates.myTemplate.label =
    '<text transform="translate(300, 750) rotate(-90)" fill="#F57C00" text-anchor="middle" x="{x}" y="{y}">{val}</text>';

    Type declaration

    icon: { add: any; csv: any; cursor: any; details: any; edit: any; excel: any; expand_all: any; fit: any; full_screen: any; happy: any; layout_grid: any; layout_left_offset: any; layout_mixed: any; layout_normal: any; layout_right_offset: any; layout_tree: any; link: any; pdf: any; png: any; powerpoint: any; pppreview: any; redo: any; remove: any; sad: any; share: any; svg: any; undo: any; user: any; visio: any; xml: any; zoom_in: any; zoom_out: any }

    SVG icons

    param w

    width

    param h

    height

    param c

    color

    param x

    X position

    param y

    Y position

    returns

    string with the SVG definition

    Type declaration

    • add:function
      • add(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let addIcon = OrgChart.icon.add(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • csv:function
      • csv(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let csvIcon = OrgChart.icon.csv(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • cursor:function
      • cursor(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let cursorIcon = OrgChart.icon.cursor(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • details:function
      • details(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let detailsIcon = OrgChart.icon.details(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • edit:function
      • edit(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let editIcon = OrgChart.icon.edit(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • excel:function
      • excel(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let excelIcon = OrgChart.icon.excel(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • expand_all:function
      • expand_all(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let expand_allIcon = OrgChart.icon.expand_all(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • fit:function
      • fit(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let fitIcon = OrgChart.icon.fit(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • full_screen:function
      • full_screen(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let full_screenIcon = OrgChart.icon.full_screen(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • happy:function
      • happy(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let happyIcon = OrgChart.icon.happy(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • layout_grid:function
      • layout_grid(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let layout_gridIcon = OrgChart.icon.layout_grid(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • layout_left_offset:function
      • layout_left_offset(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let layout_left_offsetIcon = OrgChart.icon.layout_left_offset(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • layout_mixed:function
      • layout_mixed(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let layout_mixedIcon = OrgChart.icon.layout_mixed(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • layout_normal:function
      • layout_normal(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let layout_normalIcon = OrgChart.icon.layout_normal(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • layout_right_offset:function
      • layout_right_offset(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let layout_right_offsetIcon = OrgChart.icon.layout_right_offset(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • layout_tree:function
      • layout_tree(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let layout_treeIcon = OrgChart.icon.layout_tree(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • link:function
      • link(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let linkIcon = OrgChart.icon.link(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • pdf:function
      • pdf(w: string | number, h: string | number, c: string, x?: string | number, y?: string | number): string
      • let pdfIcon = OrgChart.icon.pdf(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • png:function
      • png(w: string | number, h: string | number, c: string, x?: string | number, y?: string | number): string
      • let pngIcon = OrgChart.icon.png(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • powerpoint:function
      • powerpoint(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let powerPointIcon = OrgChart.icon.powerpoint(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • pppreview:function
      • pppreview(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let powerPointPreviewIcon = OrgChart.icon.pppreview(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • redo:function
      • redo(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let redoIcon = OrgChart.icon.redo(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • remove:function
      • remove(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let removeIcon = OrgChart.icon.remove(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • sad:function
      • sad(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let sadIcon = OrgChart.icon.sad(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • share:function
      • share(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let shareIcon = OrgChart.icon.share(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • svg:function
      • svg(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let svgIcon = OrgChart.icon.svg(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • undo:function
      • undo(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let undoIcon = OrgChart.icon.undo(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • user:function
      • user(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let userIcon = OrgChart.icon.user(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • visio:function
      • visio(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let visioIcon = OrgChart.icon.visio(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • xml:function
      • xml(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let xmlIcon = OrgChart.icon.xml(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • zoom_in:function
      • zoom_in(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let zoom_inIcon = OrgChart.icon.zoom_in(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    • zoom_out:function
      • zoom_out(w: string | number, h: string | number, c: string | number, x?: string | number, y?: string | number): string
      • let zoom_outIcon = OrgChart.icon.zoom_out(24, 24, "#7A7A7A");
        

        Parameters

        • w: string | number
        • h: string | number
        • c: string | number
        • Optional x: string | number
        • Optional y: string | number

        Returns string

    loading: { hide: any; show: any }

    Shows/hides lloading image. Usefull when export large data to pdf. You can override and show your own loading image.

    Type declaration

    • hide:function
      • let chart = new OrgChart('#tree', {});
        fetch('https://balkan.app/content/100k.json')
        .then((response) => response.json())
        .then((data) => chart.load(data, function () {
        OrgChart.loading.hide(chart);
        }));

        Parameters

        Returns void

        void

    • show:function
      • let chart = new OrgChart('#tree', {});
        chart.on('init', function (sender) {
        OrgChart.loading.show(sender);
        });

        Parameters

        Returns void

        void

    scroll: { chrome?: { smooth?: number; speed?: number }; edge?: { smooth?: number; speed?: number }; firefox?: { smooth?: number; speed?: number }; opera?: { smooth?: number; speed?: number }; safari?: { smooth?: number; speed?: number }; smooth?: number; speed?: number }

    You can change the smooth and the speed of the scroll or you can change the values for any specific browser

    OrgChart.scroll.smooth = 12;
    OrgChart.scroll.speed = 120;
    OrgChart.scroll.safari = {
    smooth: 12,
    speed: 500
    }
    let chart = new OrgChart(document.getElementById("tree"), {
    ...
    showXScroll: true,
    });

    Type declaration

    • Optional chrome?: { smooth?: number; speed?: number }
      • Optional smooth?: number
      • Optional speed?: number
    • Optional edge?: { smooth?: number; speed?: number }
      • Optional smooth?: number
      • Optional speed?: number
    • Optional firefox?: { smooth?: number; speed?: number }
      • Optional smooth?: number
      • Optional speed?: number
    • Optional opera?: { smooth?: number; speed?: number }
      • Optional smooth?: number
      • Optional speed?: number
    • Optional safari?: { smooth?: number; speed?: number }
      • Optional smooth?: number
      • Optional speed?: number
    • Optional smooth?: number
    • Optional speed?: number
    slinkTemplates: {}
    OrgChart.slinkTemplates.myTemplate = Object.assign({}, OrgChart.slinkTemplates.orange);
    OrgChart.slinkTemplates.myTemplate.labelPosition = 'start';

    Type declaration

    templates: {}
    OrgChart.templates.mainTemplate = Object.assign({}, OrgChart.templates.ana);
    OrgChart.templates.mainTemplate.node =
    `<rect x="0" y="0" height="80" width="300" fill="#039BE5" stroke-width="1" stroke="#686868" rx="40" ry="40"></rect>`;

    Type declaration

    Accessors

    • get leftElement(): HTMLElement
    • Returns HTMLElement

    Event Listeners Methods

    • on(type: "init" | "field" | "update" | "add" | "remove" | "renderbuttons" | "label" | "render-link" | "drag" | "drop" | "redraw" | "expcollclick" | "exportstart" | "exportend" | "click" | "dbclick" | "slink-click" | "clink-click" | "up-click" | "searchclick" | "import" | "updated" | "key-down" | "visibility-change" | "renderdefs" | "render" | "prerender" | "screen-reader-text" | "ready" | "ripple" | "node-initialized" | "nodes-initialized" | "node-layout", listener: (sender: OrgChart, args?: any, args1?: any, args2?: any) => boolean | void): OrgChart
    • The on() method of the OrgChart class sets up a function that will be called whenever the specified event is delivered to the target. *

      let chart = new OrgChart('#tree', {});
      chart.on('init', function () {
      // console.log("initiated")
      })
      chart.load(nodes);

      Parameters

      • type: "init" | "field" | "update" | "add" | "remove" | "renderbuttons" | "label" | "render-link" | "drag" | "drop" | "redraw" | "expcollclick" | "exportstart" | "exportend" | "click" | "dbclick" | "slink-click" | "clink-click" | "up-click" | "searchclick" | "import" | "updated" | "key-down" | "visibility-change" | "renderdefs" | "render" | "prerender" | "screen-reader-text" | "ready" | "ripple" | "node-initialized" | "nodes-initialized" | "node-layout"

        A case-sensitive string representing the event type to listen for.

      • listener: (sender: OrgChart, args?: any, args1?: any, args2?: any) => boolean | void

        The object that receives a notification when an event of the specified type occurs. This must be a JavaScript function.

          • (sender: OrgChart, args?: any, args1?: any, args2?: any): boolean | void
          • Parameters

            • sender: OrgChart
            • Optional args: any
            • Optional args1: any
            • Optional args2: any

            Returns boolean | void

      Returns OrgChart

    • Occurs when a node has been added by addNode method.

      var chart = new OrgChart('#tree', {});
      chart.onAddNode((args) => {
      //return false; to cancel the operation
      });

      Parameters

      Returns OrgChart

    • onCanvasClick(listener: (args: { event: any }) => void): OrgChart
    • On canvas SVG click event listener.

      let chart = new OrgChart('#tree', {});
      chart.onCanvasClick(() => {
      });
      chart.load(nodes);

      Parameters

      • listener: (args: { event: any }) => void
          • (args: { event: any }): void
          • Parameters

            • args: { event: any }
              • event: any

                the browser event

            Returns void

      Returns OrgChart

    • onDrag(listener: (args: { dragId: string | number; event: MouseEvent; nodeIds: (string | number)[] }) => void): OrgChart
    • The onDrag event occurs when a node is dragged. enableDragDrop option has to be turned on.

      var chart = new OrgChart('#tree', {});
      chart.onDrag(() => {
      //return false; to cancel the operation
      });

      Parameters

      • listener: (args: { dragId: string | number; event: MouseEvent; nodeIds: (string | number)[] }) => void
          • (args: { dragId: string | number; event: MouseEvent; nodeIds: (string | number)[] }): void
          • Parameters

            • args: { dragId: string | number; event: MouseEvent; nodeIds: (string | number)[] }
              • dragId: string | number

                dragged node id

              • event: MouseEvent
              • nodeIds: (string | number)[]

                array of node ids

                this property is initialized only if movable option is set

            Returns void

      Returns OrgChart

    • onDrop(listener: (args: { dragId: string | number; dragNodeElement: HTMLElement; dropId: string | number; event: MouseEvent }) => void): OrgChart
    • The onDrop event occurs when a node is dropped. enableDragDrop option has to be turned on.

      var chart = new OrgChart('#tree', {});
      chart.onDrop(() => {
      //return false; to cancel the operation
      });

      Parameters

      • listener: (args: { dragId: string | number; dragNodeElement: HTMLElement; dropId: string | number; event: MouseEvent }) => void
          • (args: { dragId: string | number; dragNodeElement: HTMLElement; dropId: string | number; event: MouseEvent }): void
          • Parameters

            • args: { dragId: string | number; dragNodeElement: HTMLElement; dropId: string | number; event: MouseEvent }
              • dragId: string | number

                dragged node id

              • dragNodeElement: HTMLElement

                draging element

              • dropId: string | number

                dropped node id

              • event: MouseEvent

                Mouse event

            Returns void

      Returns OrgChart

    • onExpandCollapseButtonClick(listener: (args: { collapsing: boolean; id: string | number; ids: (string | number)[] }) => void): OrgChart
    • The onExpandCollapseButtonClick event occurs when the chart is redrawed.

      let chart = new OrgChart('#tree', {});
      chart.onExpandCollapseButtonClick(() => {
      //return false; to cancel the operation
      });
      chart.load(nodes);

      Parameters

      • listener: (args: { collapsing: boolean; id: string | number; ids: (string | number)[] }) => void
          • (args: { collapsing: boolean; id: string | number; ids: (string | number)[] }): void
          • Parameters

            • args: { collapsing: boolean; id: string | number; ids: (string | number)[] }
              • collapsing: boolean

                Indicates id the operation is collaps or expand

              • id: string | number

                the id of the clicked node

              • ids: (string | number)[]

                node ids that will be expanded or collapsed

            Returns void

      Returns OrgChart

    • onExportEnd(listener: (args: { ArrayBuffer: ArrayBuffer; content: string; ext: string; filename: string; nodes: object[]; styles: string }) => void): OrgChart
    • Occurs in the beginning of the export. Use this event listener to hide loading image or upload exported document to your server using ArrayBuffer argument.

      let chart = new OrgChart('#tree', {});
      chart.onExportEnd(() => {
      //return false; to cancel the operation for example id you prefer the exported document to not download
      });
      chart.load(nodes);

      Parameters

      • listener: (args: { ArrayBuffer: ArrayBuffer; content: string; ext: string; filename: string; nodes: object[]; styles: string }) => void
          • (args: { ArrayBuffer: ArrayBuffer; content: string; ext: string; filename: string; nodes: object[]; styles: string }): void
          • Parameters

            • args: { ArrayBuffer: ArrayBuffer; content: string; ext: string; filename: string; nodes: object[]; styles: string }
              • ArrayBuffer: ArrayBuffer

                the array buffer is the exported document, you can save it on a server or send it via email

                this property is initialized only for PDF/PNG exports

              • content: string

                csv ot xml string

                this property is initialized only for CSV/XML/SVG exports

              • ext: string

                extension

                this property is initialized only for CSV/XML exports

              • filename: string

                filename, you can change the filename here

                this property is initialized only for CSV/XML exports

              • nodes: object[]

                an array of node objects

                this property is initialized only for CSV/XML exports

              • styles: string

                add extra styles

                this property is initialized only for SVG exports

            Returns void

      Returns OrgChart

    • onExportStart(listener: (args: { options: { childLevels?: number; expandChildren?: boolean; fileName?: string; footer?: string; header?: string; height?: number; landscape?: boolean; margin?: number[]; min?: boolean; openInNewTab?: boolean; padding?: number; pages?: { chartInstance?: OrgChart; childLevels?: number; content?: string; expandChildren?: boolean; footer?: string; header?: string; height?: number; isProfile?: boolean; margin?: number[]; min?: boolean; nodeId?: string | number; padding?: number; parentLevels?: number; width?: number }[]; parentLevels?: number; type?: string; width?: number }; pages?: SVGElement[]; styles?: string }) => void): OrgChart
    • Occurs in the beginning of the export. Extra css styles can be added to the exported document using this event listener or show loading image.

      let chart = new OrgChart('#tree', {});
      chart.onExportStart(() => {
      args.styles += '<link href="[link to my styles]" rel="stylesheet">';
      //return false; to cancel the operation
      });
      chart.load(nodes);

      Parameters

      • listener: (args: { options: { childLevels?: number; expandChildren?: boolean; fileName?: string; footer?: string; header?: string; height?: number; landscape?: boolean; margin?: number[]; min?: boolean; openInNewTab?: boolean; padding?: number; pages?: { chartInstance?: OrgChart; childLevels?: number; content?: string; expandChildren?: boolean; footer?: string; header?: string; height?: number; isProfile?: boolean; margin?: number[]; min?: boolean; nodeId?: string | number; padding?: number; parentLevels?: number; width?: number }[]; parentLevels?: number; type?: string; width?: number }; pages?: SVGElement[]; styles?: string }) => void
          • (args: { options: { childLevels?: number; expandChildren?: boolean; fileName?: string; footer?: string; header?: string; height?: number; landscape?: boolean; margin?: number[]; min?: boolean; openInNewTab?: boolean; padding?: number; pages?: { chartInstance?: OrgChart; childLevels?: number; content?: string; expandChildren?: boolean; footer?: string; header?: string; height?: number; isProfile?: boolean; margin?: number[]; min?: boolean; nodeId?: string | number; padding?: number; parentLevels?: number; width?: number }[]; parentLevels?: number; type?: string; width?: number }; pages?: SVGElement[]; styles?: string }): void
          • Parameters

            • args: { options: { childLevels?: number; expandChildren?: boolean; fileName?: string; footer?: string; header?: string; height?: number; landscape?: boolean; margin?: number[]; min?: boolean; openInNewTab?: boolean; padding?: number; pages?: { chartInstance?: OrgChart; childLevels?: number; content?: string; expandChildren?: boolean; footer?: string; header?: string; height?: number; isProfile?: boolean; margin?: number[]; min?: boolean; nodeId?: string | number; padding?: number; parentLevels?: number; width?: number }[]; parentLevels?: number; type?: string; width?: number }; pages?: SVGElement[]; styles?: string }
              • options: { childLevels?: number; expandChildren?: boolean; fileName?: string; footer?: string; header?: string; height?: number; landscape?: boolean; margin?: number[]; min?: boolean; openInNewTab?: boolean; padding?: number; pages?: { chartInstance?: OrgChart; childLevels?: number; content?: string; expandChildren?: boolean; footer?: string; header?: string; height?: number; isProfile?: boolean; margin?: number[]; min?: boolean; nodeId?: string | number; padding?: number; parentLevels?: number; width?: number }[]; parentLevels?: number; type?: string; width?: number }
                • Optional childLevels?: number
                • Optional expandChildren?: boolean
                • Optional fileName?: string
                • Optional footer?: string
                • Optional header?: string
                • Optional height?: number
                • Optional landscape?: boolean
                • Optional margin?: number[]
                • Optional min?: boolean
                • Optional openInNewTab?: boolean
                • Optional padding?: number
                • Optional pages?: { chartInstance?: OrgChart; childLevels?: number; content?: string; expandChildren?: boolean; footer?: string; header?: string; height?: number; isProfile?: boolean; margin?: number[]; min?: boolean; nodeId?: string | number; padding?: number; parentLevels?: number; width?: number }[]
                • Optional parentLevels?: number
                • Optional type?: string
                • Optional width?: number
              • Optional pages?: SVGElement[]
              • Optional styles?: string

            Returns void

      Returns OrgChart

    • Occurs when the nodes in OrgChart has been created and loaded to the DOM.

      let chart = new OrgChart('#tree', {});
      chart.onInit(() => {
      });
      chart.load(nodes);

      Parameters

      • listener: () => void
          • (): void
          • Returns void

      Returns OrgChart

    • onNodeClick(listener: (args: { event: any; node: node }) => void): OrgChart
    • On node click event listener.

      let chart = new OrgChart('#tree', {});
      chart.onNodeClick(() => {
      //return false; to cancel the operation
      });
      chart.load(nodes);

      Parameters

      • listener: (args: { event: any; node: node }) => void
          • (args: { event: any; node: node }): void
          • Parameters

            • args: { event: any; node: node }
              • event: any

                the browser event

              • node: node

                node JSON object

            Returns void

      Returns OrgChart

    • onNodeDoubleClick(listener: (args: { data: object }) => void): OrgChart
    • On node double click event listener.

      let chart = new OrgChart('#tree', {});
      chart.onNodeDoubleClick(() => {
      //return false; to cancel the operation
      });
      chart.load(nodes);

      Parameters

      • listener: (args: { data: object }) => void
          • (args: { data: object }): void
          • Parameters

            • args: { data: object }
              • data: object

                clicked node data

            Returns void

      Returns OrgChart

    • onRedraw(listener: () => void): OrgChart
    • The onRedraw event occurs when the chart is redrawed.

      let chart = new OrgChart('#tree', {});
      chart.onRedraw(() => {
      });
      chart.load(nodes);

      Parameters

      • listener: () => void
          • (): void
          • Returns void

      Returns OrgChart

    • onRemoveNode(listener: (args: { id: string | number; newPidsAndStpidsForIds: { newPidsForIds: {}; newStpidsForIds: {} } }) => void): OrgChart
    • Occurs when a node has been removed by removeNode method.

      var chart = new OrgChart('#tree', {});
      chart.onRemoveNode((args) => {
      //return false; to cancel the operation
      });

      Parameters

      • listener: (args: { id: string | number; newPidsAndStpidsForIds: { newPidsForIds: {}; newStpidsForIds: {} } }) => void
          • (args: { id: string | number; newPidsAndStpidsForIds: { newPidsForIds: {}; newStpidsForIds: {} } }): void
          • Parameters

            • args: { id: string | number; newPidsAndStpidsForIds: { newPidsForIds: {}; newStpidsForIds: {} } }
              • id: string | number

                node id

              • newPidsAndStpidsForIds: { newPidsForIds: {}; newStpidsForIds: {} }

                parent ids and sub tree parents ids that needs to be updated on the server. For example if you remove a node that has children all chilren nodes will change their pid to the parent node id of the removed node.

                • newPidsForIds: {}
                  • newStpidsForIds: {}

                Returns void

          Returns OrgChart

        • Occurs when new nodes are added, removed, updated or imported, also when slink or clink is added or removed and after undo or redo operations. Use this event listener to synch your server side database with this.config.nodes, this.config.clinks, this.config.slinks etc.

          var chart = new OrgChart('#tree', {});
          chart.onUpdated(() => {
          //Update your server database with this.config.nodes, this.config.clinks, this.config.slinks etc.
          });

          Returns OrgChart

        Other Methods

        • Adds new node to the nodes collection

          let chart = new OrgChart('#tree', {});
          ...
          chart.add({ id: 2, pid: 1, name: "Ashley Barnett", title: "Sales Manager" })
          chart.draw();

          Parameters

          • data: object

            node data

          Returns OrgChart

        • addClink(from: string | number, to: string | number, label?: string, template?: string): OrgChart
        • Adds curved link.

          let chart = new OrgChart('#tree', {});
          ...
          chart.addClink(4, 0, 'text')
          chart.draw();

          Parameters

          • from: string | number

            from node with id

          • to: string | number

            to node with id

          • Optional label: string

            link label

          • Optional template: string

            link template, for example 'orange'

          Returns OrgChart

        • addNode(data: nodeData, callback?: () => void, fireEvent?: boolean): void
        • Adds new node to the nodes collection, redraws the chart and fires remove event

          let chart = new OrgChart('#tree', {});
          ...
          chart.addNode({ id: 1, name: "Denny Curtis", title: "CEO" });

          Parameters

          • data: nodeData

            node data

          • Optional callback: () => void

            called at the end of animation

              • (): void
              • Returns void

          • Optional fireEvent: boolean

            indicates if the add event will be called or not

          Returns void

        • addSlink(from: string | number, to: string | number, label?: string, template?: string): OrgChart
        • Adds second link.

          let chart = new OrgChart('#tree', {});
          ...
          chart.addSlink(4, 0, 'text')
          chart.draw();

          Parameters

          • from: string | number

            from node with id

          • to: string | number

            to node with id

          • Optional label: string

            link label

          • Optional template: string

            link template, for example 'orange'

          Returns OrgChart

        • canRemove(id: string | number): boolean
        • If specified node has assistant/s or partner/s as children will return false.

          let chart = new OrgChart('#tree', {});
          ...
          let canRemove = chart.canRemove(2);

          Parameters

          • id: string | number

            identification number of the node

          Returns boolean

        • canUpdateLink(id: string | number, pid: string | number): boolean
        • Can update link (Does the node is dropping under itself)

          let canDropTheNode = chart.canUpdateLink(draggedNodeId, droppedNodeId));
          

          Parameters

          • id: string | number

            child id

          • pid: string | number

            parent id

          Returns boolean

        • center(nodeId: string | number, options?: null | { childrenState: any; horizontal: boolean; parentState: any; rippleId: string | number; vertical: boolean }, callback?: () => void): void
        • Centers specified node on the screen.

          let chart = new OrgChart('#tree', {});
          ...
          chart.center(2);

          Parameters

          • nodeId: string | number

            the id of the node

          • Optional options: null | { childrenState: any; horizontal: boolean; parentState: any; rippleId: string | number; vertical: boolean }

            parentState: OrgChart.COLLAPSE_PARENT_NEIGHBORS, childrenState: OrgChart.COLLAPSE_SUB_CHILDRENS, rippleId: rippleId, vertical: false, horizontal: false

          • Optional callback: () => void

            called when the animation completes

              • (): void
              • Returns void

          Returns void

        • changeRoots(id: string | number, roots: (string | number)[], callback?: () => void): void
        • Changes roots order.

          let chart = new OrgChart('#tree', {});
          ...
          chart.changeRoots(1, [2]);

          Parameters

          • id: string | number

            id of a node that will not change is position, can be null

          • roots: (string | number)[]

            roots id array in the required order

          • Optional callback: () => void

            called after the roots are changed and animation completes

              • (): void
              • Returns void

          Returns void

        • clearRedo(): void
        • Clears all Redo stack steps.

          let chart = new OrgChart('#tree', {});
          ...
          chart.clearRedo();

          Returns void

        • clearUndo(): void
        • Clears all Undo stack steps.

          let chart = new OrgChart('#tree', {});
          ...
          chart.clearUndo();

          Returns void

        • collapse(id: string | number, ids: (string | number)[], callback?: () => void): void
        • Collapses specified nodes.

          let chart = new OrgChart('#tree', {});
          ...
          chart.collapse(1, [2]);

          Parameters

          • id: string | number

            the id of the node that will not move

          • ids: (string | number)[]

            node ids that will be collapsed

          • Optional callback: () => void

            called after the animation completes

              • (): void
              • Returns void

          Returns void

        • destroy(): void
        • Destroys the object.

          let chart = new OrgChart('#tree', {});
          ...
          chart.destroy();

          Returns void

        • draw(action?: action, actionParams?: any, callback?: () => void): void
        • Draws the chart.

          let chart = new OrgChart('#tree', {});
          ...
          chart.update({ id: 1, name: "Updated Name", title: "Updated Title" });
          chart.draw();

          Parameters

          • Optional action: action

            Action for example OrgChart.action.centerNode, default is OrgChart.action.update

          • Optional actionParams: any

            parameters for the action

          • Optional callback: () => void

            called when the animation completes

              • (): void
              • Returns void

          Returns void

        • expand(id: string | number, ids: (string | number)[] | "all", callback?: () => void): void
        • Expands specified nodes.

          let chart = new OrgChart('#tree', {});
          ...
          chart.expand(1, [2]);

          Parameters

          • id: string | number

            the id of the node that will not move during the animation

          • ids: (string | number)[] | "all"

            node ids that will be expanded

          • Optional callback: () => void

            called after the animation completes

              • (): void
              • Returns void

          Returns void

        • expandCollapse(id: string | number, expandIds: (string | number)[], collapseIds: (string | number)[], callback?: () => void): void
        • Expand/Collapse lists of nodes.

          let chart = new OrgChart('#tree', {});
          ...
          chart.expandCollapse(1, [2], [3]);

          Parameters

          • id: string | number

            the id of the node that will not move

          • expandIds: (string | number)[]

            expand all nodes with ids

          • collapseIds: (string | number)[]

            collpase all nodes with ids

          • Optional callback: () => void

            called after the animation completes

              • (): void
              • Returns void

          Returns void

        • Exports to CSV

          let chart = new OrgChart('#tree', {});
          ...
          chart.exportToCSV();

          Parameters

          Returns void

        • Exports to JSON

          let chart = new OrgChart('#tree', {});
          ...
          chart.exportToJSON();

          Parameters

          Returns void

        • Parameters

          • Optional options: exportPDFOptions
          • Optional callback: () => void
              • (): void
              • Returns void

          Returns void

        • exportToPDFProfile(nodeId: string | number, callback?: () => void): void
        • Parameters

          • nodeId: string | number
          • Optional callback: () => void
              • (): void
              • Returns void

          Returns void

        • Parameters

          • Optional options: exportPNGOptions
          • Optional callback: () => void
              • (): void
              • Returns void

          Returns void

        • Parameters

          • Optional options: exportSVGOptions
          • Optional callback: () => void
              • (): void
              • Returns void

          Returns void

        • Exports to Visio document

          let chart = new OrgChart('#tree', {});
          ...
          chart.exportToVisio();

          Parameters

          • Optional options: exportVisioOptions

            export options

          • Optional callback: () => void

            called when the export completes See doc...

              • (): void
              • Returns void

          Returns void

        • Exports to XML

          let chart = new OrgChart('#tree', {});
          ...
          chart.exportToXML();

          Parameters

          Returns void

        • fit(callback?: () => void): void
        • Fits the content to the visible area.

          let chart = new OrgChart('#tree', {});
          ...
          chart.fit();

          Parameters

          • Optional callback: () => void

            called when the animation completes

              • (): void
              • Returns void

          Returns void

        • fitIfOutside(callback?: () => void): void
        • Fits the content to the visible area if it is ouside of the visible area.

          let chart = new OrgChart('#tree', {});
          ...
          chart.fitOfOutside();

          Parameters

          • Optional callback: () => void

            called when the animation completes

              • (): void
              • Returns void

          Returns void

        • generateId(): string
        • Genereates unique identification number that can be used for new nodes

          let chart = new OrgChart('#tree', {});
          ...
          let id = chart.generateId();

          Returns string

        • Gets node data.

          let chart = new OrgChart('#tree', {});
          ...
          let node = chart.get(2);

          Parameters

          • id: string | number

            identification number of the node

          Returns nodeData

        • getCollapsedIds(node: node): (string | number)[]
        • Gets collpased node ids of the specifeid node

          let chart = new OrgChart('#tree', {});
          ...
          let ids = chart.getCollapsedIds(2);

          Parameters

          Returns (string | number)[]

        • getMenuButton(): HTMLElement
        • Gets menu button html element

          let chart = new OrgChart('#tree', {});
          ...
          let menuButton = chart.getMenuButton(2);

          Returns HTMLElement

        • getNode(nodeId: string | number): node
        • Gets the node as OrgChart.node object.

          let chart = new OrgChart('#tree', {});
          ...
          let node = chart.getNode(2);

          Parameters

          • nodeId: string | number

          Returns node

        • getNodeElement(id: string | number): HTMLElement
        • Gets node html element

          let chart = new OrgChart('#tree', {});
          ...
          let nodeElement = chart.getNodeElement(2);

          Parameters

          • id: string | number

            node id

          Returns HTMLElement

        • getScale(viewBox?: number[]): number
        • Gets the current scale of the chart.

          let chart = new OrgChart('#tree', {});
          ...
          let scale = chart.getScale();

          Parameters

          • Optional viewBox: number[]

          Returns number

        • getSvg(): SVGAElement
        • Gets svg html element

          let chart = new OrgChart('#tree', {});
          ...
          let svg = chart.getSvg();

          Returns SVGAElement

        • getViewBox(): number[]
        • Gets the view box attribute of the svg html element.

          let chart = new OrgChart('#tree', {});
          ...
          let viewBox = chart.getViewBox();

          Returns number[]

        • getXML(): string
        • Gets nodes as xml.

          let chart = new OrgChart('#tree', {});
          let xml = chart.getXML();

          Returns string

        • height(): number
        • let chart = new OrgChart('#tree', {});
          ...
          let height = chart.height();

          Gets the height of the container.

          Returns number

        • importCSV(): void
        • Imports CSV file.

          let chart = new OrgChart('#tree', {});
          ...
          chart.importCSV();

          See doc...

          Returns void

        • importJSON(): void
        • Imports JSON file.

          let chart = new OrgChart('#tree', {});
          ...
          chart.importJSON();

          See doc...

          Returns void

        • importXML(): void
        • Imports XML file.

          let chart = new OrgChart('#tree', {});
          ...
          chart.importXML();

          See doc...

          Returns void

        • init(element?: null | string | HTMLElement, options?: options): void
        • Init method can be used if the chart needs to be instantiated without parameters, and init can be called later.

          let chart = new OrgChart();
          chart.init('#tree', {})

          Parameters

          • Optional element: null | string | HTMLElement
          • Optional options: options

          Returns void

        • Load nodes data.

          let chart = new OrgChart('#tree', {});
          ...
          chart.load([
          { id: 1, name: "Denny Curtis" },
          { id: 2, pid: 1, name: "Ashley Barnett" },
          { id: 3, pid: 1, name: "Caden Ellison" }
          ]);

          Parameters

          • data: nodeData[]

            nodes data array

          • Optional callback: () => void

            function called after the load

              • (): void
              • Returns void

          Returns OrgChart

        • loadXML(xml: string, callback?: () => void): OrgChart
        • Loads nodes from xml.

          let chart = new OrgChart('#tree', {});
          let xml = '<?xml version="1.0" encoding="utf-8" ?><nodes><node id="1" pids="2" name="Amber McKenzie" gender="female"/><node id="2" pids="1" name="Ava Field" gender="male"/><node id="3" pids="4,5" mid="1" fid="2" name="Peter Stevens" gender="male"/></nodes>';
          chart.loadXML(xml);

          Parameters

          • xml: string

            Xml with node structure

          • Optional callback: () => void

            function called after the load

              • (): void
              • Returns void

          Returns OrgChart

        • magnify(id: string | number, scale: number, front?: boolean, anim?: null | anim, callback?: () => void): void
        • Magnify(Zoom in) specific node in the chart.

          let chart = new OrgChart('#tree', {});
          ...
          chart.magnify(2, 1.25);

          Parameters

          • id: string | number

            id of the node

          • scale: number

            scale to magnify

          • Optional front: boolean

            show on front or back

          • Optional anim: null | anim

            animation type

          • Optional callback: () => void
              • (): void
              • Returns void

          Returns void

        • maximize(id?: string | number, horizontalCenter?: boolean, verticalCenter?: boolean, callback?: () => void): void
        • Maximize the node. Without parameters maximize all nodes.

          let chart = new OrgChart('#tree', {});
          ...
          chart.maximize();

          Parameters

          • Optional id: string | number

            the id of the node, if id is null, undefined ot empty string will maximize all nodes

          • Optional horizontalCenter: boolean

            center horizontally

          • Optional verticalCenter: boolean

            center vertically

          • Optional callback: () => void

            called when the animation completes

              • (): void
              • Returns void

          Returns void

        • minimize(id?: string | number, callback?: () => void): void
        • let chart = new OrgChart('#tree', {});
          ...
          chart.minimize();

          Minimize the node. Without parameters minimize all nodes.

          Parameters

          • Optional id: string | number

            the id of the node, if id is null, undefined ot empty string will minimize all nodes

          • Optional callback: () => void

            called when the animation completes

              • (): void
              • Returns void

          Returns void

        • moveEnd(): void
        • Ends the move

          let chart = new OrgChart('#tree', {});
          ...
          chart.moveEnd();

          Returns void

        • moveNodesToVisibleArea(ids: (string | number)[], callback?: () => void): void
        • let chart = new OrgChart('#tree', {});
          ...
          chart.moveNodesToVisibleArea([2, 3]);

          Moves specified nodes to the visible area.

          Parameters

          • ids: (string | number)[]

            Array of node ids

          • Optional callback: () => void

            called at the end of animation

              • (): void
              • Returns void

          Returns void

        • moveStart(movePosition: move, tick?: () => void, func?: anim, duration?: number): void
        • Starts the move

          let chart = new OrgChart('#tree', {});
          ...
          chart.moveStart({right: true});

          Parameters

          • movePosition: move

            move position

          • Optional tick: () => void

            callback function in each step

              • (): void
              • Returns void

          • Optional func: anim

            the name of the animation function, for example OrgChart.anim.inSin

          • Optional duration: number

            duration before going to 100 percent speed

          Returns void

        • onAIToolCalls(listener: (args: { toolCalls: { FunctionArguments: {}; FunctionName: string; FunctionResult: string }[] }) => void): OrgChart
        • In onAIToolCalls we parse the AI responce to our functions

          chart.onAIToolCalls(function(args){
          for(var toolCall of args.toolCalls){
          if (toolCall.FunctionName == 'sendEmail'){
          toolCall.FunctionResult = sendEmail(toolCall.FunctionArguments);
          }
          }
          });

          Go to AI doc page for more details

          Parameters

          • listener: (args: { toolCalls: { FunctionArguments: {}; FunctionName: string; FunctionResult: string }[] }) => void
              • (args: { toolCalls: { FunctionArguments: {}; FunctionName: string; FunctionResult: string }[] }): void
              • Parameters

                • args: { toolCalls: { FunctionArguments: {}; FunctionName: string; FunctionResult: string }[] }
                  • toolCalls: { FunctionArguments: {}; FunctionName: string; FunctionResult: string }[]

                Returns void

          Returns OrgChart

        • redo(callback?: () => void): void
        • Redo data operations like adding/removing nodes. Set undoRedoStorageName option before calling this method.

          let chart = new OrgChart('#tree', {});
          ...
          chart.redo();

          Parameters

          • Optional callback: () => void

            called when the animation completes

              • (): void
              • Returns void

          Returns void

        • redoStepsCount(): number
        • Returns the number of Redo stack steps

          let chart = new OrgChart('#tree', {});
          ...
          let redoSteps = chart.redoStepsCount();

          Returns number

        • Removes specified node from nodes collection

          let chart = new OrgChart('#tree', {});
          ...
          chart.remove(2);
          chart.draw();

          Parameters

          • id: string | number

            identification number of the node

          Returns OrgChart

        • removeClink(from: string | number, to: string | number): OrgChart
        • Removes curved link.

          let chart = new OrgChart('#tree', {});
          ...
          chart.removeClink(4, 0)
          chart.draw();

          Parameters

          • from: string | number

            from node with id

          • to: string | number

            to node with id

          Returns OrgChart

        • removeListener(type: "init" | "field" | "update" | "add" | "remove" | "renderbuttons" | "label" | "render-link" | "drag" | "drop" | "redraw" | "expcollclick" | "exportstart" | "exportend" | "click" | "dbclick" | "slink-click" | "clink-click" | "up-click" | "searchclick" | "import" | "updated" | "key-down" | "visibility-change" | "renderdefs" | "render" | "prerender" | "screen-reader-text" | "ready" | "ripple" | "node-initialized" | "nodes-initialized" | "node-layout", listener?: () => void): boolean
        • Removes an event listener previously registered. The event listener to be removed is identified using a combination of the event type and the event listener function itself. Returns true if success and false if fail.

          let chart = new OrgChart('#tree', {});
          let listener = function(sender, args){
          console.log(sender.removeListener('update', listener));
          };
          chart.on('update', listener);
          chart.load(nodes)

          };

          family.on('update', listener);

          Parameters

          • type: "init" | "field" | "update" | "add" | "remove" | "renderbuttons" | "label" | "render-link" | "drag" | "drop" | "redraw" | "expcollclick" | "exportstart" | "exportend" | "click" | "dbclick" | "slink-click" | "clink-click" | "up-click" | "searchclick" | "import" | "updated" | "key-down" | "visibility-change" | "renderdefs" | "render" | "prerender" | "screen-reader-text" | "ready" | "ripple" | "node-initialized" | "nodes-initialized" | "node-layout"

            A string which specifies the type of event for which to remove an event listener

          • Optional listener: () => void

            The event listener function of the event handler to remove from the event target

              • (): void
              • Returns void

          Returns boolean

        • removeNode(id: string | number, callback?: () => void, fireEvent?: boolean): void
        • Removes specified node from nodes collection, redraws the chart and fires remove event.

          var chart = new OrgChart('#tree', {});
          chart.removeNode(2);

          Parameters

          • id: string | number

            identification number of the node

          • Optional callback: () => void

            called at the end of animation

              • (): void
              • Returns void

          • Optional fireEvent: boolean

            indicates if the remove event will be called or not

          Returns void

        • removeSlink(from: string | number, to: string | number): OrgChart
        • Removes second link.

          let chart = new OrgChart('#tree', {});
          ...
          chart.removeSlink(4, 0)
          chart.draw();

          Parameters

          • from: string | number

            from node with id

          • to: string | number

            to node with id

          Returns OrgChart

        • replaceIds(old_new_ids: {}, callback?: () => void): void
        • Replaces the id, pid, stpid, ppid and the ids in clinks, slinks, dottedLines, groupDottedLines. After the replacment updates the UI

          let chart = new OrgChart('#tree', {});
          ...
          chart.replaceIds[{2:21, 3:31});

          Parameters

          • old_new_ids: {}

            dictionary containing old and new ids

            • [key: string]: string | number
          • Optional callback: () => void

            called when the replacment completes

              • (): void
              • Returns void

          Returns void

        • ripple(id: string | number, clientX?: number, clientY?: number): void
        • Animates specified node with ripple animation - highlight the node.

          let chart = new OrgChart('#tree', {});
          ...
          chart.ripple(2);

          Parameters

          • id: string | number

            the id of the node

          • Optional clientX: number

            x value of the ripple center in the node

          • Optional clientY: number

            y value of the ripple center in the node

          Returns void

        • search(value: string, searchInFields?: string[], retrieveFields?: string[]): { __score: number; __searchField: string; __searchMarks: string; id: string | number; name: string }[]
        • Search in the chart.

          let chart = new OrgChart('#tree', {});
          ...
          chart.search("Ava");

          Parameters

          • value: string

            search for value

          • Optional searchInFields: string[]

            search in field names

          • Optional retrieveFields: string[]

            retrive data for fields See doc...

          Returns { __score: number; __searchField: string; __searchMarks: string; id: string | number; name: string }[]

        • setLayout(layout: number | layout, lcn?: string): void
        • Sets layout.

          let chart = new OrgChart('#tree', {});
          ...
          chart.setLayout(OrgChart.tree);

          Parameters

          • layout: number | layout

            layout type

          • Optional lcn: string

            lyout config name for the specified sub tree

          Returns void

        • setOrientation(orientation: orientation, lcn?: string, callback?: () => void): void
        • Sets orientation.

          let chart = new OrgChart('#tree', {});
          ...
          chart.setOrientation(2);

          Parameters

          • orientation: orientation

            orientation type

          • Optional lcn: string

            lyout config name for the specified sub tree

          • Optional callback: () => void

            called at the end of animation

              • (): void
              • Returns void

          Returns void

        • setScale(newScale: number): number
        • Sets the current scale of the chart. Returns the actual scale limited by scaleMax and scaleMin

          let chart = new OrgChart('#tree', {});
          ...
          chart.setScale(1.2);

          Parameters

          • newScale: number

            new scale value

          Returns number

        • setViewBox(viewBox: number[]): void
        • Sets the view box attribute of the svg html element.

          let chart = new OrgChart('#tree', {});
          ...
          chart.setViewBox();

          Parameters

          • viewBox: number[]

          Returns void

        • shareProfile(id: string | number): void
        • let chart = new OrgChart('#tree', {});
          ...
          chart.shareProfile(2);

          Shares node data, uses build-in device sharing functionallity.

          Parameters

          • id: string | number

            node id

          Returns void

        • stateToUrl(): string
        • State to url.

          let chart = new OrgChart('#tree', {});
          ...
          let url = chart.stateToUrl();

          See doc...

          Returns string

        • toggleFullScreen(): void
        • Toggles full screen mode.

          let chart = new OrgChart('#tree', {});
          ...
          chart.toggleFullScreen();

          Returns void

        • undo(callback?: () => void): void
        • Undo data operations like adding/removing nodes. Set undoRedoStorageName option before calling this method.

          let chart = new OrgChart('#tree', {});
          ...
          chart.undo();

          Parameters

          • Optional callback: () => void

            called when the animation completes

              • (): void
              • Returns void

          Returns void

        • undoStepsCount(): number
        • Returns the number of Undo stack steps

          let chart = new OrgChart('#tree', {});
          ...
          let undoSteps = chart.undoStepsCount();

          Returns number

        • Updates the node data

          let chart = new OrgChart('#tree', {});
          ...
          chart.update({ id: 1, name: "Updated Name", title: "Updated Title" });
          chart.draw();

          Parameters

          • newData: object

            node data

          Returns OrgChart

        • updateNode(data: nodeData, callback?: () => void, fireEvent?: boolean): void
        • Updates the node data, redraws the chart and fires update event.

          let chart = new OrgChart('#tree', {});
          ...
          chart.updateNode({ id: 4, pid: 2, name: "Updated Name", title: "Updated Title" });

          Parameters

          • data: nodeData

            node data

          • Optional callback: () => void

            function called when the animation completes

              • (): void
              • Returns void

          • Optional fireEvent: boolean

            if it set to true the update event is called

          Returns void

        • width(): number
        • Gets the width of the container.

          let chart = new OrgChart('#tree', {});
          ...
          let width = chart.width();

          Returns number

        • zoom(delta: number | boolean, center?: number[], shouldAnimate?: boolean, callback?: () => void): void
        • Zoom out or zoom in the chart.

          let chart = new OrgChart('#tree', {});
          ...
          chart.zoom(true);

          Parameters

          • delta: number | boolean

            true for zoom in, false for zoom out or scale number, if scale is > 1 it will zoom in and scale < 1 zoom out.

          • Optional center: number[]

            array [x, y], where x is x percantege from the width and y is y percentage from the height.

          • Optional shouldAnimate: boolean

            should animate

          • Optional callback: () => void

            called when the animation completes

              • (): void
              • Returns void

          Returns void

        • animate(element: Object, attrStart?: Object, attrEnd?: Object, duration?: number, func?: anim, callback?: Function, tick?: Function): void
        • Animate an element

          editForm.prototype.show = function (nodeId) {
          OrgChart.animate(div, { opacity: 0, right: -100 }, { opacity: 1, right: 10 }, 300, OrgChart.anim.outSin);
          };

          Parameters

          • element: Object

            element

          • Optional attrStart: Object

            object with start CSS properties

          • Optional attrEnd: Object

            object with end CSS properties

          • Optional duration: number

            duration in miliseconds

          • Optional func: anim

            funcition to animate with

          • Optional callback: Function

            callback function

          • Optional tick: Function

          Returns void

        • convertCsvToNodes(text: string): Object[]
        • Convert CSV to nodes

          let chart = new OrgChart('#tree', {});
          fetch('https://balkan.app/content/data.csv')
          .then(response => response.text())
          .then(text => {
          var nodes = OrgChart.convertCsvToNodes(text);
          chart.load(nodes);
          });

          Parameters

          • text: string

          Returns Object[]

        • fileUploadDialog(callback: (file: any) => void): void
        • Opens file upload dialog

          let chart = new OrgChart('#tree', {});
          

          chart.editUI.on('element-btn-click', function (sender, args) { OrgChart.fileUploadDialog(function (file) { var formData = new FormData(); formData.append('file', file); alert('upload the file'); }) });

          chart.load(nodes)

          
          

          Parameters

          • callback: (file: any) => void
              • (file: any): void
              • Parameters

                • file: any

                Returns void

          Returns void

        • Get the root node of the specified id.

          let chart = new OrgChart('#tree', {});
          chart.onInit(() => {
          let root = OrgChart.getRootOf(chart.getNode(4));
          });
          chart.load(nodes)

          Parameters

          Returns node

        • gradientCircleForDefs(id: string | number, colors: string | string[], r: number, strokeWidth: number): string
        • Defines gradient circle form array of colors

          OrgChart.templates.myTemplate.defs = OrgChart.gradientCircleForDefs('circle', ['#FF0000', '#FFD800'], 60, 10);
          

          Parameters

          • id: string | number

            id of the element

          • colors: string | string[]

            array of colors

          • r: number

            radius

          • strokeWidth: number

            stroke width

          Returns string

        • isMobile(): boolean
        • Checks if the screen is mobile

          console.log(OrgChart.isMobile());
          

          Returns boolean

        • isNEU(val: any): boolean
        • is null, empty or undefined

          console.log(OrgChart.isNEU(any_prmeter))
          

          Parameters

          • val: any

          Returns boolean

        • isTrial(): boolean
        • Checks if the used library is licnsed or not

          console.log(OrgChart.isTrial());
          

          Returns boolean

        • randomId(): any
        • Generates random id for a node

          let id = OrgChart.randomId();
          

          Returns any

        • wrapText(value: Object, svgElementAsSring: string, width?: number, lines?: number): string
        • Wraps and formats text to fit within a given width and number of lines, returning an SVG-compatible string.

          The method measures the provided value and inserts line breaks so the text fits inside the specified width. If the text exceeds the allowed number of lines, it will be truncated according to the internal wrapping rules.

          Parameters

          • value: Object
          • svgElementAsSring: string
          • Optional width: number
          • Optional lines: number

          Returns string

        Legend

        • Constructor
        • Property
        • Method
        • Static property
        • Static method
        • Inherited method

        Settings

        Theme

        Generated using TypeDoc