首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >D3.js Org Chart

D3.js Org Chart

作者头像
geovindu
发布2026-06-18 20:54:34
发布2026-06-18 20:54:34
200
举报

geovindu.csv

代码语言:javascript
复制
"id","parentId","name","lastName","position","image","email","phone_number","hire_date","job_id","salary","commission_pct","department_id","job_min_salary","location_state","job_max_salary","department_name","department_location_id","department_location_street_address","department_location_postal_code","department_location_country_id","department_location_country_name","department_location_country_region_id","department_location_country_region_name"
"100","","聚文","涂","CEO(首席执行官)","avatars/portrait12.png","geovindu@163.com","515.123.4567","2003-07-16T19:00:00.000Z","AD_PRES","24000","","90","20080","上海","40000","Executive","1700","学院路1388","98199","CN","中华人民共和国","2","亚洲"
"101","100","小六","李","业务总监","avatars/portrait85.png","geovindu@163.com","515.123.4568","2005-10-20T20:00:00.000Z","AD_VP","17000","","90","15000","上海","30000","Executive","1700","学院路1388","98199","CN","中华人民共和国","2","亚洲"
"102","100","华夏","江","行政总监","avatars/portrait16.png","geovindu@163.com","515.123.4569","2001-02-12T20:00:00.000Z","AD_VP","17000","","90","15000","上海","30000","Executive","1700","学院路1388","98199","CN","中华人民共和国","2","亚洲"
"103","102","杰文","艾","程序员","avatars/portrait17.png","geovindu@163.com","590.423.4567","2006-02-02T20:00:00.000Z","IT_PROG","9000","","60","4000","深圳","10000","IT","1400","丽苑路1888","26192","CN","中华人民共和国","2","亚洲"
"104","103","兴国","李","程序员","avatars/portrait18.png","geovindu@163.com","590.423.4568","2007-06-20T20:00:00.000Z","IT_PROG","6000","","60","4000","深圳","10000","IT","1400","丽苑路1888","26192","CN","中华人民共和国","2","亚洲"
"105","103","建国","何","程序员","avatars/portrait19.png","geovindu@163.com","590.423.4569","2005-07-24T20:00:00.000Z","IT_PROG","4800","","60","4000","深圳","10000","IT","1400","丽苑路1888","26192","CN","中华人民共和国","2","亚洲"
"106","103","北京","黄","程序员","avatars/portrait86.png","geovindu@163.com","590.423.4560","2006-03-04T20:00:00.000Z","IT_PROG","4800","","60","4000","深圳","10000","IT","1400","丽苑路1888","26192","CN","中华人民共和国","2","亚洲"
"107","103","东坡","苏","程序员","avatars/portrait89.png","geovindu@163.com","590.423.5567","2007-03-06T20:00:00.000Z","IT_PROG","4200","","60","4000","深圳","10000","IT","1400","丽苑路1888","26192","CN","中华人民共和国","2","亚洲"
"108","101","修","欧阳","财务经理","avatars/portrait61.png","geovindu@163.com","515.124.4569","2002-09-16T19:00:00.000Z","FI_MGR","12008","","100","8200","深圳","16000","Finance","1700","丽苑路1888","98199","CN","中华人民共和国","2","亚洲"

chart.js

代码语言:javascript
复制
/**
 * Minified by jsDelivr using Terser v5.19.2.
 * Original file: /npm/d3-org-chart@3.0.1/build/d3-org-chart.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
! function(t, e) {
    "object" == typeof exports && "undefined" != typeof module ? e(exports, require("d3-selection"), require("d3-array"), require("d3-hierarchy"), require("d3-zoom"), require("d3-flextree"), require("d3-shape")) : "function" == typeof define && define.amd ? define(["exports", "d3-selection", "d3-array", "d3-hierarchy", "d3-zoom", "d3-flextree", "d3-shape"], e) : e(t.d3 = t.d3 || {}, t.d3, t.d3, t.d3, t.d3, t.d3, t.d3)
}(this, (function(t, e, n, a, i, o, r) {
            "use strict";
            const d = {
                selection: e.selection,
                select: e.select,
                max: n.max,
                min: n.min,
                sum: n.sum,
                cumsum: n.cumsum,
                tree: a.tree,
                stratify: a.stratify,
                zoom: i.zoom,
                zoomIdentity: i.zoomIdentity,
                linkHorizontal: r.linkHorizontal,
                flextree: o.flextree
            };
            t.OrgChart = class {
                    constructor() {
                            const t = {
                                id: `ID${Math.floor(1e6*Math.random())}`,
                                firstDraw: !0,
                                ctx: document.createElement("canvas").getContext("2d"),
                                initialExpandLevel: 1,
                                nodeDefaultBackground: "none",
                                lastTransform: {
                                    x: 0,
                                    y: 0,
                                    k: 1
                                },
                                allowedNodesCount: {},
                                zoomBehavior: null,
                                generateRoot: null,
                                svgWidth: 800,
                                svgHeight: window.innerHeight - 100,
                                container: "body",
                                data: null,
                                connections: [],
                                defaultFont: "Helvetica",
                                nodeId: t => t.nodeId || t.id,
                                parentNodeId: t => t.parentNodeId || t.parentId,
                                rootMargin: 40,
                                nodeWidth: t => 250,
                                nodeHeight: t => 150,
                                neighbourMargin: (t, e) => 80,
                                siblingsMargin: t => 20,
                                childrenMargin: t => 60,
                                compactMarginPair: t => 100,
                                compactMarginBetween: t => 20,
                                nodeButtonWidth: t => 40,
                                nodeButtonHeight: t => 40,
                                nodeButtonX: t => -20,
                                nodeButtonY: t => -20,
                                linkYOffset: 30,
                                pagingStep: t => 5,
                                minPagingVisibleNodes: t => 2e3,
                                scaleExtent: [.001, 20],
                                duration: 400,
                                imageName: "Chart",
                                setActiveNodeCentered: !0,
                                layout: "top",
                                compact: !0,
                                createZoom: t => d.zoom(),
                                onZoomStart: t => {},
                                onZoom: t => {},
                                onZoomEnd: t => {},
                                onNodeClick: t => t,
                                onExpandOrCollapse: t => t,
                                nodeContent: t => `<div style="padding:5px;font-size:10px;">Sample Node(id=${t.id}), override using <br/> \n            <code>chart.nodeContent({data}=>{ <br/>\n                 return '' // Custom HTML <br/>\n             })</code>\n             <br/> \n             Or check different <a href="https://github.com/bumbeishvili/org-chart#jump-to-examples" target="_blank">layout examples</a>\n             </div>`,
                                buttonContent: ({
                                    node: t,
                                    state: e
                                }) => `<div style="border:1px solid #E4E2E9;border-radius:3px;padding:3px;font-size:9px;margin:auto auto;background-color:white"> ${
  
/*
* 提示:该行代码过长,系统自动注释不进行高亮。一键复制会移除系统注释 
* {left:e=>e?`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n                      <path d="M14.283 3.50094L6.51 11.4749C6.37348 11.615 6.29707 11.8029 6.29707 11.9984C6.29707 12.194 6.37348 12.3819 6.51 12.5219L14.283 20.4989C14.3466 20.5643 14.4226 20.6162 14.5066 20.6516C14.5906 20.6871 14.6808 20.7053 14.772 20.7053C14.8632 20.7053 14.9534 20.6871 15.0374 20.6516C15.1214 20.6162 15.1974 20.5643 15.261 20.4989C15.3918 20.365 15.4651 20.1852 15.4651 19.9979C15.4651 19.8107 15.3918 19.6309 15.261 19.4969L7.9515 11.9984L15.261 4.50144C15.3914 4.36756 15.4643 4.18807 15.4643 4.00119C15.4643 3.81431 15.3914 3.63482 15.261 3.50094C15.1974 3.43563 15.1214 3.38371 15.0374 3.34827C14.9534 3.31282 14.8632 3.29456 14.772 3.29456C14.6808 3.29456 14.5906 3.31282 14.5066 3.34827C14.4226 3.38371 14.3466 3.43563 14.283 3.50094V3.50094Z" fill="#716E7B" stroke="#716E7B"/>\n                      </svg></span><span style="color:#716E7B">${t.data._directSubordinatesPaging} </span></div>`:`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n                          <path d="M7.989 3.49944C7.85817 3.63339 7.78492 3.8132 7.78492 4.00044C7.78492 4.18768 7.85817 4.36749 7.989 4.50144L15.2985 11.9999L7.989 19.4969C7.85817 19.6309 7.78492 19.8107 7.78492 19.9979C7.78492 20.1852 7.85817 20.365 7.989 20.4989C8.05259 20.5643 8.12863 20.6162 8.21261 20.6516C8.2966 20.6871 8.38684 20.7053 8.478 20.7053C8.56916 20.7053 8.6594 20.6871 8.74338 20.6516C8.82737 20.6162 8.90341 20.5643 8.967 20.4989L16.74 12.5234C16.8765 12.3834 16.9529 12.1955 16.9529 11.9999C16.9529 11.8044 16.8765 11.6165 16.74 11.4764L8.967 3.50094C8.90341 3.43563 8.82737 3.38371 8.74338 3.34827C8.6594 3.31282 8.56916 3.29456 8.478 3.29456C8.38684 3.29456 8.2966 3.31282 8.21261 3.34827C8.12863 3.38371 8.05259 3.43563 7.989 3.50094V3.49944Z" fill="#716E7B" stroke="#716E7B"/>\n                          </svg></span><span style="color:#716E7B">${t.data._directSubordinatesPaging} </span></div>`,bottom:e=>e?`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n                       <path d="M19.497 7.98903L12 15.297L4.503 7.98903C4.36905 7.85819 4.18924 7.78495 4.002 7.78495C3.81476 7.78495 3.63495 7.85819 3.501 7.98903C3.43614 8.05257 3.38462 8.12842 3.34944 8.21213C3.31427 8.29584 3.29615 8.38573 3.29615 8.47653C3.29615 8.56733 3.31427 8.65721 3.34944 8.74092C3.38462 8.82463 3.43614 8.90048 3.501 8.96403L11.4765 16.74C11.6166 16.8765 11.8044 16.953 12 16.953C12.1956 16.953 12.3834 16.8765 12.5235 16.74L20.499 8.96553C20.5643 8.90193 20.6162 8.8259 20.6517 8.74191C20.6871 8.65792 20.7054 8.56769 20.7054 8.47653C20.7054 8.38537 20.6871 8.29513 20.6517 8.21114C20.6162 8.12715 20.5643 8.05112 20.499 7.98753C20.3651 7.85669 20.1852 7.78345 19.998 7.78345C19.8108 7.78345 19.6309 7.85669 19.497 7.98753V7.98903Z" fill="#716E7B" stroke="#716E7B"/>\n                       </svg></span><span style="margin-left:1px;color:#716E7B" >${t.data._directSubordinatesPaging} </span></div>\n                       `:`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n                       <path d="M11.457 8.07005L3.49199 16.4296C3.35903 16.569 3.28485 16.7543 3.28485 16.9471C3.28485 17.1398 3.35903 17.3251 3.49199 17.4646L3.50099 17.4736C3.56545 17.5414 3.64304 17.5954 3.72904 17.6324C3.81504 17.6693 3.90765 17.6883 4.00124 17.6883C4.09483 17.6883 4.18745 17.6693 4.27344 17.6324C4.35944 17.5954 4.43703 17.5414 4.50149 17.4736L12.0015 9.60155L19.4985 17.4736C19.563 17.5414 19.6405 17.5954 19.7265 17.6324C19.8125 17.6693 19.9052 17.6883 19.9987 17.6883C20.0923 17.6883 20.1849 17.6693 20.2709 17.6324C20.3569 17.5954 20.4345 17.5414 20.499 17.4736L20.508 17.4646C20.641 17.3251 20.7151 17.1398 20.7151 16.9471C20.7151 16.7543 20.641 16.569 20.508 16.4296L12.543 8.07005C12.4729 7.99653 12.3887 7.93801 12.2954 7.89801C12.202 7.85802 12.1015 7.8374 12 7.8374C11.8984 7.8374 11.798 7.85802 11.7046 7.89801C11.6113 7.93801 11.527 7.99653 11.457 8.07005Z" fill="#716E7B" stroke="#716E7B"/>\n                       </svg></span><span style="margin-left:1px;color:#716E7B" >${t.data._directSubordinatesPaging} </span></div>\n                    `,right:e=>e?`<div style="display:flex;"><span style="align-items:center;display:flex;"><svg width="8" height="8" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n                       <path d="M7.989 3.49944C7.85817 3.63339 7.78492 3.8132 7.78492 4.00044C7.78492 4.18768 7.85817 4.36749 7.989 4.50144L15.2985 11.9999L7.989 19.4969C7.85817 19.6309 7.78492 19.8107 7.78492 19.9979C7.78492 20.1852 7.85817 20.365 7.989 20.4989C8.05259
*/
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2025-02-04,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档