データベースから特定の従業員の名前、役職、写真を取得し、Gojs を使用してグラフに表示したいと考えています。私は Gojs の初心者で、静的な面しか知りません。クエリをどこに置くべきかわかりません。
<script>
var $ = go.GraphObject.make;
var myDiagram =
$(go.Diagram, "myDiagramDiv",
{
initialContentAlignment: go.Spot.Center, // center Diagram contents
"undoManager.isEnabled": true, // enable Ctrl-Z to undo and Ctrl-Y to redo
layout: $(go.TreeLayout, // specify a Diagram.layout that arranges trees
{ angle: 90, layerSpacing: 40 })
});
// the template we defined earlier
myDiagram.nodeTemplate =
$(go.Node, "Vertical",
{ background: "#44CCFF" },
$(go.Picture,
{ margin: 10, width: 100, height: 100, background: "red" },
new go.Binding("source")),
$(go.TextBlock, "Default Text",
{ margin: 12, stroke: "white", font: "bold 13px sans-serif" },
new go.Binding("text", "name")),
$(go.TextBlock, "Default Text",
{ margin: 12, stroke: "white", font: "bold 13px sans-serif" },
new go.Binding("text", "position"))
);
// define a Link template that routes orthogonally, with no arrowhead
myDiagram.linkTemplate =
$(go.Link,
{ routing: go.Link.Orthogonal, corner: 5 },
$(go.Shape, { strokeWidth: 3, stroke: "#555" })); // the link shape
var model = $(go.TreeModel);
model.nodeDataArray =
[
{ key: "1", name: "JAMES BRYAN B. JUVENTUD", position: " (Regional Director)", source: "james.jpg" },
{ key: "2", parent: "1", name: "VERGIL H. MEDIDAS", position: "OIC", source: "vergil.jpg" }
];
myDiagram.model = model;
</script>