gojs05
Toggle class name on click in jQuery
by batobolg
HTML
<script src="https://gojs.net/latest/release/go.js"></script>
<div id="d1" style="width:300px; height:200px; border-style: solid;"></div>
JavaScript
function showContent() {
var $go = go.GraphObject.make;
let diagramA = $go(go.Diagram, "d1", { "undoManager.isEnabled": true, });
// define the Node template
diagramA.nodeTemplate =
$go(go.Node, "Auto", {
rotatable: true, locationSpot: go.Spot.LeftCenter,
},
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
new go.Binding("zOrder").makeTwoWay(),
$go(go.Shape,
{
stroke: null,
},
new go.Binding("fill", "color").makeTwoWay()
),
$go(go.TextBlock, {
name: "TEXT",
font: "10pt sans-serif",
editable: true, // editing the text automatically updates the model data
},
new go.Binding("text").makeTwoWay(),
new go.Binding("font"),
new go.Binding("stroke","tcolor").makeTwoWay(),
)
);
diagramA.groupTemplate = $go(go.Group, "Vertical",{
memberAdded: function(thisGroup, newPart) {
console.log("thisGroup");
console.log("newPart");
}
},
$go(go.Panel, "Auto",
$go(go.Shape, "RoundedRectangle", // surrounds the Placeholder
{ parameter1: 14,
fill: "rgba(128,128,128,0.33)" }),
$go(go.Placeholder, // represents the area of all member parts,
{ padding: 5}) // with some extra padding around them
),
$go(go.TextBlock, // group title
{ alignment: go.Spot.Right, font: "Bold 12pt Sans-Serif" },
new go.Binding("text"))
);
// Create the Diagram's Model:
var nodeDataArray = [
{ key: 1, text: "Alpha1", color: "lightblue", size:"100 70", loc:"100 100", zOrder: -1 ,
font: "13px Serif"},
{ key: 2, text: "Alpha2", color: "lightblue", size:"100 70", loc:"140 120", zOrder: -1 ,
font: "Italic 30px Georgia, Serif", group: 4 },
{ key: 3, text: "Alpha3", color: "lightblue", size:"100 70", loc:"160 140", zOrder: -1 ,
font: "Italic 15px Georgia, Serif", group: 4},
{ key: 4, text: "Group4",...