i Use OrgChart.js (BalkanGraph), and i Read my data from sql server with Ajax but i don't know how i show my nodes of Orgchart. enter image description here
this is my script :
<script >
var chart = new OrgChart(document.getElementById("tree"), {
nodeBinding: {
field_0: "UO",
field_1:"Uo_Rattachement"
},
menu: {
pdf: { text: "Export PDF" },
png: { text: "Export PNG" },
svg: { text: "Export SVG" },
csv: { text: "Export CSV" }
},
nodeContextMenu: {
edit: { text: "Edit", icon: OrgChart.icon.edit(18, 18, '#039BE5') },
add: { text: "Add", icon: OrgChart.icon.add(18, 18, '#FF8304') }
},
nodeMenu: {
details: { text: "Details" },
edit: { text: "Edit" },
add: { text: "Add" },
remove: { text: "Remove" }
},
nodes: []
});
$.ajax({
type: "POST",
url: "WebForm1.aspx/ReadData",
//data: ( list),
dataType: "json",
contentType: "application/json",
traditional: true,
success: function (response) {
if (response != null && response.d != null) {
var data = response.d;//this data already is json which represent list of Node so that you can iterate with each
$.each(data, function (index, node) {
console.log(node);
});
}
}
});
i need to show my data as nodes of orgchart, how can i do it !! thank u