Skip to content

Commit

Permalink
add icons option
Browse files Browse the repository at this point in the history
  • Loading branch information
dabeng committed May 9, 2023
1 parent 36a00f5 commit ba2baa1
Show file tree
Hide file tree
Showing 27 changed files with 565 additions and 446 deletions.
9 changes: 9 additions & 0 deletions demo/css/fontawesome.min.css

Large diffs are not rendered by default.

146 changes: 146 additions & 0 deletions demo/custom-icons.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Organization Chart Plugin</title>
<link rel="icon" href="img/logo.png">
<link rel="stylesheet" href="css/fontawesome.min.css" >
<link rel="stylesheet" href="css/jquery.orgchart.css">
<link rel="stylesheet" href="css/style.css">
<style type="text/css">
#chart-container { height: 540px; }
.orgchart { padding-bottom: 20px; }

.orgchart .node .title .parentNodeSymbol {
margin-top: 7px;
margin-left: 2px;
}

.orgchart .node .edge::before {
color: rgba(68, 157, 68, 0.75);
}

.orgchart .edge:hover::before {
color: #449d44;
}

.orgchart .node .verticalEdge::before {
left: calc(50% - 6px);
}

.orgchart .node .horizontalEdge::before {
top: calc(50% - 0.5px);
}

.orgchart .node .topEdge.fa-angles-up::before {
top: 2px;
}

.orgchart .node .topEdge.fa-angles-down::before {
bottom: 4px;
}

.orgchart .node .bottomEdge.fa-angles-up::before {
bottom: 4px;
}

.orgchart .node .bottomEdge.fa-angles-down::before {
bottom: 1px;
}

.orgchart .node .leftEdge.fa-angles-right::before {
left: -3px;
}

.orgchart .node .leftEdge.fa-angles-left::before {
left: 1px;
}

.orgchart .node .rightEdge.fa-angles-left::before {
right: -3px;
}

.orgchart .node .rightEdge.fa-angles-right::before {
right: 1px;
}

.orgchart .node .toggleBtn::before {
bottom: 7px;
font-size: 16px;
background-color: white;
color: rgb(96, 188, 96);
}
.orgchart .node .toggleBtn:hover::before {
background-color: white;
color: #1d8a1d;
}
</style>
</head>
<body>
<div id="chart-container"></div>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.orgchart.js"></script>
<script type="text/javascript">
$(function() {

var datascource = {
'id': '1',
'name': 'Lao Lao',
'title': 'general manager',
'children': [
{ 'id': '2', 'name': 'Bo Miao', 'title': 'department manager' },
{ 'id': '3', 'name': 'Su Miao', 'title': 'department manager',
'children': [
{ 'id': '4', 'name': 'Tie Hua', 'title': 'senior engineer' },
{ 'id': '5', 'name': 'Hei Hei', 'title': 'senior engineer',
'children': [
{ 'id': '6', 'name': 'Pang Pang', 'title': 'engineer' },
{ 'id': '7', 'name': 'Dan Dan', 'title': 'UE engineer' ,
'children': [
{ 'id': '8', 'name': 'Er Dan', 'title': 'engineer' },
{ 'id': '9', 'name': 'San Dan', 'title': 'engineer',
'children': [
{ 'id': '10', 'name': 'Si Dan', 'title': 'intern' },
{ 'id': '11', 'name': 'Wu Dan', 'title': 'intern' }
]
}
]}
]
}
]
},
{ 'id': '13', 'name': 'Chun Miao', 'title': 'department manager', 'isHybrid': true,
'children': [
{ 'id': '14', 'name': 'Bing Qin', 'title': 'senior engineer' },
{ 'id': '15', 'name': 'Yue Yue', 'title': 'senior engineer',
'children': [
{ 'id': '16', 'name': 'Er Yue', 'title': 'engineer' },
{ 'id': '17', 'name': 'San Yue', 'title': 'UE engineer' }
]
}
]
}
]
};

$('#chart-container').orgchart({
'data' : datascource,
'nodeContent': 'title',
'verticalLevel': 5,
'icons': {
'theme': 'fa-solid fa-sm',
'parentNode': 'fa-user-tie',
'expandToUp': 'fa-angles-up',
'collapseToDown': 'fa-angles-down',
'collapseToLeft': 'fa-angles-left',
'expandToRight': 'fa-angles-right',
'collapsed': 'fa-circle-plus',
'expanded': 'fa-circle-minus'
}
});

});
</script>
</body>
</html>
1 change: 1 addition & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
<li><a href="nodes-of-different-widths.html" target="_blank">nodes of different widths</a></li>
<li><a href="drag-drop-hybrid-chart.html" target="_blank">drag&drop in hybrid chart</a></li>
<li><a href="isHybrid.html" target="_blank">create hybrid chart with isHybrid</a></li>
<li><a href="custom-icons.html" target="_blank">use fontawesome icons instead of built-in icons</a></li>
</ol>
</section>
</body>
Expand Down
8 changes: 4 additions & 4 deletions demo/multiple-layers.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
.orgchart .drill-icon {
transition: opacity .5s;
opacity: 0;
right: -10px;
top: -10px;
right: -8px;
top: -8px;
z-index: 2;
position: absolute;
}
Expand Down Expand Up @@ -92,7 +92,7 @@
if ($node.is('.drill-down')) {
var assoClass = data.className.match(/asso-\w+/)[0];
var drillDownIcon = $('<i>', {
'class': 'oci oci-arrow-circle-down drill-icon',
'class': 'oci oci-arrow-square-down drill-icon',
'click': function() {
$('#chart-container').find('.orgchart:visible').addClass('hidden');
if (!$('#chart-container').find('.orgchart.' + assoClass).length) {
Expand All @@ -106,7 +106,7 @@
} else if ($node.is('.drill-up')) {
var assoClass = data.className.match(/asso-\w+/)[0];
var drillUpIcon = $('<i>', {
'class': 'oci oci-arrow-circle-up drill-icon',
'class': 'oci oci-arrow-square-up drill-icon',
'click': function() {
$('#chart-container').find('.orgchart:visible').addClass('hidden').end()
.find('.drill-down.' + assoClass).closest('.orgchart').removeClass('hidden');
Expand Down
4 changes: 2 additions & 2 deletions demo/option-createNode.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
.orgchart .second-menu-icon {
transition: opacity .5s;
opacity: 0;
right: -5px;
top: -5px;
right: -8px;
top: -8px;
z-index: 2;
position: absolute;
}
Expand Down
3 changes: 3 additions & 0 deletions demo/pan-zoom.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<link rel="icon" href="img/logo.png">
<link rel="stylesheet" href="css/jquery.orgchart.css">
<link rel="stylesheet" href="css/style.css">
<style type="text/css">
.orgchart { background: white; }
</style>
</head>
<body>
<div id="chart-container"></div>
Expand Down
34 changes: 17 additions & 17 deletions demo/vertical-level.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,39 @@
$(function() {

var datascource = {
'id': '1',
'name': 'Lao Lao',
'title': 'general manager',
'children': [
{ 'id': '2', 'name': 'Bo Miao', 'title': 'department manager' },
{ 'id': '3', 'name': 'Su Miao', 'title': 'department manager',
{ 'name': 'Bo Miao', 'title': 'department manager' },
{ 'name': 'Su Miao', 'title': 'department manager',
'children': [
{ 'id': '4', 'name': 'Tie Hua', 'title': 'senior engineer' },
{ 'id': '5', 'name': 'Hei Hei', 'title': 'senior engineer',
{ 'name': 'Tie Hua', 'title': 'senior engineer' },
{ 'name': 'Hei Hei', 'title': 'senior engineer',
'children': [
{ 'id': '6', 'name': 'Pang Pang', 'title': 'engineer' },
{ 'id': '7', 'name': 'Dan Dan', 'title': 'UE engineer' ,
{ 'name': 'Pang Pang', 'title': 'engineer' },
{ 'name': 'Dan Dan', 'title': 'UE engineer' ,
'children': [
{ 'id': '8', 'name': 'Er Dan', 'title': 'engineer' },
{ 'id': '9', 'name': 'San Dan', 'title': 'engineer',
{ 'name': 'Er Dan', 'title': 'engineer' },
{ 'name': 'San Dan', 'title': 'engineer',
'children': [
{ 'id': '10', 'name': 'Si Dan', 'title': 'intern' },
{ 'id': '11', 'name': 'Wu Dan', 'title': 'intern' }
{ 'name': 'Si Dan', 'title': 'intern' },
{ 'name': 'Wu Dan', 'title': 'intern' }
]
}
]}
]
}
]
},
{ 'id': '12', 'name': 'Hong Miao', 'title': 'department manager' },
{ 'id': '13', 'name': 'Chun Miao', 'title': 'department manager',
{ 'name': 'Hong Miao', 'title': 'department manager' },
{ 'name': 'Chun Miao', 'title': 'department manager',
'children': [
{ 'id': '14', 'name': 'Bing Qin', 'title': 'senior engineer' },
{ 'id': '15', 'name': 'Yue Yue', 'title': 'senior engineer',
{ 'name': 'Bing Qin', 'title': 'senior engineer' },
{ 'name': 'Yue Yue', 'title': 'senior engineer',
'children': [
{ 'id': '16', 'name': 'Er Yue', 'title': 'engineer' },
{ 'id': '17', 'name': 'San Yue', 'title': 'UE engineer' }
{ 'name': 'San Yue', 'title': 'engineer' },
{ 'name': 'Si Yue', 'title': 'UE engineer' },
{ 'name': 'Er Yue', 'title': 'senior engineer' }
]
}
]
Expand Down
Binary file added demo/webfonts/fa-brands-400.ttf
Binary file not shown.
Binary file added demo/webfonts/fa-brands-400.woff2
Binary file not shown.
Binary file added demo/webfonts/fa-regular-400.ttf
Binary file not shown.
Binary file added demo/webfonts/fa-regular-400.woff2
Binary file not shown.
Binary file added demo/webfonts/fa-solid-900.ttf
Binary file not shown.
Binary file added demo/webfonts/fa-solid-900.woff2
Binary file not shown.
Binary file added demo/webfonts/fa-v4compatibility.ttf
Binary file not shown.
Binary file added demo/webfonts/fa-v4compatibility.woff2
Binary file not shown.
Loading

0 comments on commit ba2baa1

Please sign in to comment.