Quantcast
Channel: GoJS - Northwoods Software
Viewing all 6926 articles
Browse latest View live

After model change data is added twice (Angular)

$
0
0

@Hazzed wrote:

Hi!
I’m using Angular and gojs-angular. In my application I need to fully replace diagram model, but after this operation new nodes (dropped from palette, copied and pasted, added programatically) are added twice.

Here is a demo which replicates the issue: https://github.com/Hazzed5/gojs-model-change-issue

In the ngAfterViewInit() function changeModel() is called:

 changeModel() {
   this.graphNodeData = [];
   this.graphLinkData = [];
   const model = new go.GraphLinksModel(
     this.graphNodeData,
     this.graphLinkData
   );
   model.linkToPortIdProperty = "toPort";
   model.linkFromPortIdProperty = "fromPort";
   model.linkKeyProperty = "key";
   model.nodeKeyProperty = "key";
   model.nodeCategoryProperty = "category";
   this.graphComponent.diagram.model = model;

   this.exampleMessagesArray.forEach((message) => {
     this.graphNodeData.push(message);
   });
 }

Even though this.exampleMessagesArray contains 4 elements, this.graphNodeData and model.nodeDataArray have 8 elements with duplicated keys.

How can I fix this problem?

Posts: 3

Participants: 2

Read full topic


Is there any possibility to connect link from anywhere around node (currently i'm using multiple ports)?

$
0
0

@kumar1 wrote:

is there any possibility to connect links from anywhere around node (currently i’m using multiple ports)?
some cases i need to connect one node to more than ten nodes with link labels.

Posts: 4

Participants: 2

Read full topic

Using kendo ui in gojs

$
0
0

@Aka21 wrote:

Hi,
I am trying to implement tree mapper, but I have the tree structure developed with kendo UI. Can I make use of that and implement it in gojs? Basically, can I use kendo UI library with gojs?

Posts: 4

Participants: 2

Read full topic

Modify individual borders - Group template

$
0
0

@diego wrote:

Guys,

trying to re-create this shape

and this is what i currently have

I’m using a Horizontal group with 2 auto panels (rectangle) inside, one contains the text and the other the nodes.
I will like to use the rounded rectangle but the line in the middle (between the 2 panels) doesn’t look like a line anymore, is it possible to handle the borders individually?

Posts: 3

Participants: 2

Read full topic

Enable GuidedDragging for swimlanes nodes

MouseOver Adornments Stop Working After Model Switch

$
0
0

@agillespie wrote:

Howdy.

My diagram represents a few different data models. I’m using a set of custom adornment buttons that show on mouseOver of nodes. All that works perfectly… up until I switch the data model for the diagram. From there, the Adornments stop working. The function to add them is still firing - but it’s not actually adding the adornments.

My codebase is getting large enough that I wasn’t sure it wasn’t just something else I was doing. So I made a issue-recreation out of the “Minimal” sample.

Modified “Minimal”

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Minimal GoJS Sample</title>
  <meta name="description" content="An almost minimal diagram using a very simple node template and the default link template." />
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Copyright 1998-2020 by Northwoods Software Corporation. -->

  <script src="../GoJS/release/go.js"></script>
  <script src="../GoJS/assets/js/goSamples.js"></script>  <!-- this is only for the GoJS Samples framework -->
  <script id="code">
    function init() {
      // if (window.goSamples) goSamples();  // init for these samples -- you don't need to call this

      var $ = go.GraphObject.make;  // for conciseness in defining templates

      myDiagram = $(go.Diagram, "myDiagramDiv",  // create a Diagram for the DIV HTML element
        {
          "undoManager.isEnabled": true  // enable undo & redo
        });

      // define a simple Node template
      myDiagram.nodeTemplate =
        $(go.Node, "Auto",  // the Shape will go around the TextBlock
          $(go.Shape, "RoundedRectangle", { strokeWidth: 0, fill: "white",
            mouseOver: function(e, obj) { //that was easy.
            console.log("Still fires after model change");
            var node = obj.part;
            customButtons.adornedObject = node;
            node.addAdornment("mouseHover", customButtons); //works until the "changeModel" function runs, then no longer shows adornments
          }},
            // Shape.fill is bound to Node.data.color
            new go.Binding("fill", "color")),
          $(go.TextBlock,
            { margin: 8, font: "bold 14px sans-serif", stroke: '#333' }, // Specify a margin to add some room around the text
            // TextBlock.text is bound to Node.data.key
            new go.Binding("text", "key"))
        );

      // but use the default Link template, by not setting Diagram.linkTemplate

      var customButtons =
    //#region 
    $(go.Adornment, "Spot",
      $(go.Panel, "Horizontal",
        $(go.Placeholder)  // this represents the selected Node
      ),
      // the button to search the model (aka fill the palette)
      $("Button",
        {
          alignmentFocus: go.Spot.Right,
          alignment: go.Spot.Left,
          click: changeModel,  // this function is defined below
          toolTip:
            $("ToolTip",
              $(go.TextBlock, {
                margin: 4,
                text: "Explore This Node"
              },
              )
            ),
        },
        $(go.TextBlock, { text: 'adornment button' })
      )) // end button

      function changeModel(){
        myDiagram.model = new go.Model.fromJson(alternateModel);
      }

      // create the model data that will be represented by Nodes and Links
      myDiagram.model = new go.GraphLinksModel(
        [
          { key: "Alpha", color: "lightblue" },
          { key: "Beta", color: "orange" },
          { key: "Gamma", color: "lightgreen" },
          { key: "Delta", color: "pink" }
        ],
        [
          { from: "Alpha", to: "Beta" },
          { from: "Alpha", to: "Gamma" },
          { from: "Beta", to: "Beta" },
          { from: "Gamma", to: "Delta" },
          { from: "Delta", to: "Alpha" }
        ]);

      var alternateModel = {
        "class": "GraphLinksModel",
        "nodeDataArray": [
          { key: "Mario", color: "red" },
          { key: "Luigi", color: "green" },
          { key: "Peach", color: "pink" },
          { key: "Toad", color: "grey" }
        ],
        "linkDataArray": [
          { from: "Mario", to: "Luigi" },
          { from: "Peach", to: "Luigi" },
          { from: "Toad", to: "Luigi" },
          { from: "Peach", to: "Toad" },
          { from: "Mario", to: "Peach" }
        ]
      }
    }
  </script>
</head>
<body onload="init()">
<div id="sample">
  <!-- The DIV for the Diagram needs an explicit size or else we won't see anything.
       This also adds a border to help see the edges of the viewport. -->
  <div id="myDiagramDiv" style="border: solid 1px black; width:400px; height:400px"></div>
  <p>
    This isn't a truly <i>minimal</i> demonstration of <b>GoJS</b>,
    because we do specify a custom Node template, but it's pretty simple.
    The whole source for the sample is shown below if you click on the link.
  </p>
  <p>
    This sample sets the <a>Diagram.nodeTemplate</a>, with a <a>Node</a> template that data binds both the text string and the shape's fill color.
    For an overview of building your own templates and model data, see the <a href="../learn/index.html">Getting Started tutorial.</a>
  </p>
  <p>
    Using the mouse and common keyboard commands, you can pan, select, move, copy, delete, and undo/redo.
    On touch devices, use your finger to act as the mouse, and hold your finger stationary to bring up a context menu.
    The default context menu supports most of the standard commands that
    are enabled at that time for the selected object.
  </p>
  <p>
    For a more elaborate and capable sample, see the <a href="basic.html">Basic</a> sample.
    For a sample that loads JSON data from the server,
    see the <a href="minimalJSON.html">Minimal JSON</a> sample.
    For a sample that loads XML data from the server,
    see the <a href="minimalXML.html">Minimal XML</a> sample.
  </p>
</div>
</body>
</html>

That code demonstrates the issue. Initially, the button with text ‘adornment button’ displays on mouse over. Upon clicking the button and switching to the alternateModel, the adornment button no longer displays on mouse over — but the console log in the calling function indicates it is still firing.

What am I missing here?

Thank you,
Aaron

Posts: 1

Participants: 1

Read full topic

Port connecting issue at particular location on node

$
0
0

@kumar1 wrote:

this.dia = $(go.Diagram, {
      "draggingTool.dragsLink": true,
      "draggingTool.isGridSnapEnabled": true,
      "linkingTool.isUnconnectedLinkValid": false,
      "linkingTool.portGravity": 20,
      "relinkingTool.isUnconnectedLinkValid": true,
      "relinkingTool.portGravity": 20,
      "relinkingTool.fromHandleArchetype":
        $(go.Shape, "Diamond", { segmentIndex: 0, cursor: "pointer", desiredSize: new go.Size(8, 8), fill: "tomato", stroke: "darkred" }),
      "relinkingTool.toHandleArchetype":
        $(go.Shape, "Diamond", { segmentIndex: -1, cursor: "pointer", desiredSize: new go.Size(8, 8), fill: "darkred", stroke: "tomato" }),
      "linkReshapingTool.handleArchetype":
        $(go.Shape, "Diamond", { desiredSize: new go.Size(7, 7), fill: "lightblue", stroke: "deepskyblue" }),
      "rotatingTool.handleAngle": 270,
      "rotatingTool.handleDistance": 20,
      "rotatingTool.snapAngleMultiple": 15,
      "rotatingTool.snapAngleEpsilon": 15,
      'undoManager.isEnabled': true,
      allowDelete: true,
      allowCopy: false,
      model: $(go.GraphLinksModel,
        {
          copiesArrays: true,
          copiesArrayObjects: true,
          linkKeyProperty: 'key'
        }
      )
    });```

``` this.dia.nodeTemplate =
      $(go.Node, "Auto",  // the whole node panel
        {
          locationSpot: go.Spot.Center,
          selectionAdorned: true,
          resizable: true,
          layoutConditions: go.Part.LayoutStandard & ~go.Part.LayoutNodeSized,
          isShadowed: false,
          selectionAdornmentTemplate: nodeSelectionTemp,
          resizeAdornmentTemplate: resizeSelectionTemp
        },
        new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
        // whenever the PanelExpanderButton changes the visible property of the "LIST" panel,
        // clear out any desiredSize set by the ResizingTool.
        new go.Binding("desiredSize", "visible", function (v) { return new go.Size(NaN, NaN); }).ofObject("LIST2"),
        // define the node's outer shape, which will surround the Table
        $(go.Shape, "Rectangle",
          {
            fill: 'white', stroke: "#707070", strokeWidth: 1,
            portId: "",
            fromSpot: go.Spot.AllSides,
            toSpot: go.Spot.AllSides,
            fromLinkable: true, toLinkable: true, cursor: "pointer",
            fromLinkableDuplicates: true,
            toLinkableDuplicates:true

          })

my issue is similar to https://forum.nwoods.com/t/strange-port-linking-issue/9856
in the below image if i wanted to move anyone of the link to the top or bottom of the node or give the space between the links is not working,
if i move the nodes, links are moving automatically. is it possible now to reposition the links however we want?
Screen Shot 2020-06-25 at 12.10.47 AM

Posts: 3

Participants: 2

Read full topic

How can I use DoubleTree Layout with Groups

$
0
0

@luojiegithuber wrote:

Hi,

I’m trying to implement the DoubleTree layout example in my project. It works great for nodes but I am trying to get it working for groups also.

When I don’t use group:

I want the diagram to look like this when I introduce Gruops

But It doesn’t work.If I just changed the data, removing the field “parents” from the data and using “groups” instead, it would even break the layout and not show groups.

Posts: 4

Participants: 2

Read full topic


Wrap column in LayeredDigraphLayout

$
0
0

@Yogesh.Mohan wrote:

Need to wrap node in LayeredDigraphLayout inside Lane as its get wrap in grid layout after defining Wrapping Column

I need to override LayeredDigraphLayout so that I can able to use some of the property of LayeredDigraphLayout and GridLayout because I need to automatically adjust my nodes inside lane after some specific size using Spacing property

Right now I am using this code

function LayeredDigraphCustom() {
go.LayeredDigraphLayout.call(this);
this.isInitial = false; // don’t even do initial layout
this.isOngoing = false; // don’t invalidate layout when nodes or links are added or removed
this.direction = 0;
this.columnSpacing = 30;
this.layerSpacing = 30;
this.linkSpacing = 30;
this.setsPortSpots = false;
this.layeringOption = go.LayeredDigraphLayout.LayerLongestPathSource;
}

        go.Diagram.inherit(LayeredDigraphCustom, go.LayeredDigraphLayout);

        swimLanesGroupTemplate =
            $(go.Group, "Spot", groupStyle(),
                {
                    name: "Lane",
                    selectionAdorned: swimLaneshowSelection,  // use a Binding on the Shape.stroke to show selection
                    contextMenu: $(go.Adornment),//laneEventMenu,
                    minLocation: new go.Point(NaN, -Infinity),  // only allow vertical movement
                    maxLocation: new go.Point(NaN, Infinity),
                    selectionObjectName: "SHAPE",  // selecting a lane causes the body of the lane to be highlit, not the label
                    resizable: true, resizeObjectName: "SHAPE",  // the custom resizeAdornmentTemplate only permits two kinds of resizing
                    layout: $(LayeredDigraphCustom),
                    computesBoundsAfterDrag: true,  // needed to prevent recomputing Group.placeholder bounds too soon
                    computesBoundsIncludingLinks: false,  // to reduce occurrences of links going briefly outside the lane
                    computesBoundsIncludingLocation: true,  // to support empty space at top-left corner of lane
                    handlesDragDropForMembers: true,

but I need to update this swimLanesGroupTemplate Layout some event occurs

Posts: 4

Participants: 2

Read full topic

I (end user) need a link was attached to the place where I placed it at first

$
0
0

@kumar1 wrote:

we implemented the LinkShiftingTool, it is working good But I need also a link was attached to the place where I placed it at first (when I draw it, not after drawing). with the following reference implemented the code below
https://forum.nwoods.com/t/linkshiftingtool-fromspot-tospot/10401

private SpotLinkingTool() {
    return go.LinkingTool.call(this);
  }

  private SpotRelinkingTool() {
    return go.RelinkingTool.call(this);
  }

  public initDiagram(): go.Diagram {
    const that = this;
    const $ = go.GraphObject.make;
    this.dia = $(go.Diagram, {
      "draggingTool.dragsLink": true,
      "draggingTool.isGridSnapEnabled": true,
      "linkingTool.isUnconnectedLinkValid": false,
      "linkingTool.portGravity": 50,
      "relinkingTool.isUnconnectedLinkValid": true,
      "relinkingTool.portGravity": 50,
      "relinkingTool.fromHandleArchetype":
        $(go.Shape, "Diamond", { segmentIndex: 0, cursor: "pointer", desiredSize: new go.Size(8, 8), fill: "tomato", stroke: "darkred" }),
      "relinkingTool.toHandleArchetype":
        $(go.Shape, "Diamond", { segmentIndex: -1, cursor: "pointer", desiredSize: new go.Size(8, 8), fill: "darkred", stroke: "tomato" }),
      "linkReshapingTool.handleArchetype":
        $(go.Shape, "Diamond", { desiredSize: new go.Size(7, 7), fill: "lightblue", stroke: "deepskyblue" }),
      "rotatingTool.handleAngle": 270,
      "rotatingTool.handleDistance": 20,
      "rotatingTool.snapAngleMultiple": 15,
      "rotatingTool.snapAngleEpsilon": 15,
      'undoManager.isEnabled': true,
      linkingTool: $(this.SpotLinkingTool()),
      relinkingTool: $(this.SpotRelinkingTool()),
      allowDelete: true,
      allowCopy: false,
      model: $(go.GraphLinksModel,
        {
          copiesArrays: true,
          copiesArrayObjects: true,
          linkKeyProperty: 'key'
        }
      )
    });


    go.Diagram.inherit(this.SpotLinkingTool(), go.LinkingTool);

    this.SpotLinkingTool().prototype.insertLink = ((fromnode, fromport, tonode, toport) => {
      var link = go.LinkingTool.prototype.insertLink.call(this, fromnode, fromport, tonode, toport);
      if (link !== null) {
        var port;
        if (link.isForwards) {
          port = toport;
        } else {
          port = fromport;
        }
        var portb = new go.Rect(port.getDocumentPoint(go.Spot.TopLeft),
                                port.getDocumentPoint(go.Spot.BottomRight));
        var lp = link.getLinkPointFromPoint(port.part, port, port.getDocumentPoint(go.Spot.Center),
                                            this.dia.lastInput.documentPoint, !link.isForwards);
        var spot = new go.Spot((lp.x - portb.x) / (portb.width || 1), (lp.y - portb.y) / (portb.height || 1));
        if (link.isForwards) {
          link.toSpot = spot;
        } else {
          link.fromSpot = spot;
        }
      }
      return link;
    })


    go.Diagram.inherit(this.SpotRelinkingTool(), go.RelinkingTool);

    this.SpotRelinkingTool().prototype.reconnectLink = ((link, newnode, newport, toend) => {
      go.RelinkingTool.prototype.reconnectLink.call(this, link, newnode, newport, toend);
      if (link !== null) {
        var port = newport;
        var portb = new go.Rect(port.getDocumentPoint(go.Spot.TopLeft),
                                port.getDocumentPoint(go.Spot.BottomRight));
        var lp = link.getLinkPointFromPoint(port.part, port, port.getDocumentPoint(go.Spot.Center),
                                            this.dia.lastInput.documentPoint, !toend);
        var spot = new go.Spot((lp.x - portb.x) / (portb.width || 1), (lp.y - portb.y) / (portb.height || 1));
        if (toend) {
          link.toSpot = spot;
        } else {
          link.fromSpot = spot;
        }
      }
      return link;
    })

this is in typescript, getting issue here, i tried with created the global var for spotLiningTool and SpotRelinkingTool also

 linkingTool: $(this.SpotLinkingTool()),
      relinkingTool: $(this.SpotRelinkingTool())
  1. need to allow the user only one link between nodes is it possible to do like that?

Posts: 5

Participants: 2

Read full topic

Dragable link from pallete to canvas not validating and even not connecting to node when apply linkvalidation

$
0
0

@kumar1 wrote:

when drag the link from node to node is working fine, but when drag the link to canvase not validating.

private linkValidation(tool) {
      tool.linkValidation =  function(fromnode, fromport, tonode, toport) {
        // total number of links connecting with a port is limited to 1:
       
        if(fromnode.findLinksBetween(tonode).count < 1) {
          return true
        } else {
          return false
        }
      }
  }

public ngAfterViewInit() {
 this.linkValidation(this.dia.toolManager.linkingTool);
    this.linkValidation(this.dia.toolManager.relinkingTool);
}```

Posts: 1

Participants: 1

Read full topic

How can add diagram in Ext Js panel

$
0
0

@MB wrote:

I am trying to add a GoJS diagram in the Ext JS panel. It is not showing the diagram, rather in the console for this.down("[xtype=‘panel’]").body.dom, showing

.

index.html

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="resources/css/ext-all-gray.css">
<script type="text/javascript" src="ext-all.js"></script>
<script type="text/javascript" src="gojs/go-debug.js"></script>
<script type="text/javascript" src="extjs_go_test.js"></script>

<body>
<div id="diagramDivTest" style="border: solid 1px blue; width:100%; height:150"></div>
</body>

extjs_go_test:

Ext.onReady(function () {
Ext.create("Ext.panel.Panel", {
    title: "Configuration",
    items: [
      {

        xtype: "panel",

        name: "Diagram",

        html: "<div id='diagram'>Hello</div>",

      },

    ],

    renderTo: "diagramDivTest",
    listeners: {
      afterrender: function () {
        var $ = go.GraphObject.make;
        myDiagram = $(go.Diagram, "diagram");
        myDiagram.nodeTemplate = $(
          go.Node,
          "Auto",
          $(
            go.Shape,
            "Rectangle",
            { fill: "white" },
            new go.Binding("fill", "color")
          ),
          $(go.TextBlock, "text", { margin: 10 }, new go.Binding("text", "key"))
        );
        myDiagram.linkTemplate = $(
          go.Link,
          $(go.Shape, { strokeWidth: 3 }, new go.Binding("stroke", "color")),
          $(
            go.Shape,
            { toArrow: "Standard", stroke: null },
            new go.Binding("fill", "color")
          )
        );

        var nodeData = [
          {
            key: "Alpha",
            color: "blue",
            loc: go.Spot.Right,
            name: "Don Meow",
          },
          { key: "Beta", color: "red", loc: go.Spot.Right, name: "Don !" },
        ];
        var linkData = [
          {
            to: "Beta",
            from: "Alpha",
            color: "green",
          },
        ];
        myDiagram.model = new go.GraphLinksModel(nodeData, linkData);
      },
    },
  });
});

Thanks in advance!

Posts: 1

Participants: 1

Read full topic

Why is onModelChange not being called?

$
0
0

I’m using <ReactDiagram> and am trying to use its onModelChange event to watch for changes in my node’s position. I feel like I have it wired up correctly, since the event gets called when I change some text, but not when I change the position (via the dragging tool).

Here’s my node template and the basic onModelChange callback:

export const myNodeTemplate: go.Node = $(
  go.Node,
  'Auto',
  {
    isLayoutPositioned: false,
  },
  new go.Binding('position', 'position', (data, obj) => {
    return new go.Point(data.x, data.y)
  }).makeTwoWay((val, data, model) => {
    console.log('position changed')
    return {
      ...data.position,
      x: val.x,
      y: val.y,
    }
  }),
  $(go.Shape, 'Rectangle', { fill: 'cyan', width: 150, height: 150 }),
  $(
    go.TextBlock,
    { editable: true },
    new go.Binding('text', 'label').makeTwoWay((val, data, model) => {
      console.log('text changed')
      return val
    })
  )
)

const onModelChange = (e: go.IncrementalData) => {
  console.log('model changed')
}

// jsx for diagram
    <ReactDiagram
      ref={diagramRef}
      divClassName='diagram-editor'
      initDiagram={initDiagram}
      nodeDataArray={diagramNodes}
      linkDataArray={diagramLinks}
      onModelChange={onModelChange}
      skipsDiagramUpdate={false}
    />

I see that the makeTwoWay functions are being called for both position and text. I also see that onModelChange is being called after changes to the text, but not after changes to the position.

Why is onModelChange not being called after changes to my position here? How can I get my dragged node position changes to be passed on to onModelChange?

2 posts - 2 participants

Read full topic

DragCreatingTool - Change the figure in the shape dynamically

$
0
0

I am trying to use DragCreatingTool.js in GoJs.

default I am able to draw as rectangle shape via mouse click.

But I want to change shape into circle/rectangle dynamically outside the Go Js Button Click event.

If I execute the below code, in the tool box it change to circle.

myDiagram.startTransaction(“Update Tool Shape Figure”);
var tool = myDiagram.toolManager.findTool(“DragCreating”);
var _box = tool.box;
var _boxShape = _box.findObject(‘SHAPE’);
_boxShape.figure = “Circle”;
myDiagram.commitTransaction(“Update Tool Shape Figure”);

if I start drawing via mouse , it showing as a circle.

if I complete a circle it changed to rectangle.

Please help me to change the shape dynamically using DragCreatingTool.

2 posts - 2 participants

Read full topic

Setting location behaves strange when overlapping with other object

$
0
0

Hi,

say i have a node (actually a group) positioned programmatically by calling moveTo().
it works fine normally. but if the node is overlapping with other object ( a part consists of a polygon shape), after the moveTo() call, the node in canvas is not at the correct place.
is this behavior kind of ‘overlapping avoidance algorithm’ ? how to disable it? i want the node to be at the exact place that i moveTo().

1 post - 1 participant

Read full topic


How can I let each node in Groups to generate a tree on its own

$
0
0

In the previous topic, I asked how to use DoubleTree Layout with Groups, and was told that I could create a tree with a GraphLinksModel, which also worked well.But now, there’s a new question that puzzles me.

    var model = [
        { key: "Root", color: lavgrad },
        { key: "1", parent: "Root", dir: "left", color: bluegrad },
        { key: "2", parent: "Root", dir: "left" },
        { key: "3", parent: "Root", dir: "left" },
        { key: "4", parent: "Root", dir: "left", color: bluegrad ,
          alignment:alignmentLeft,},
        { key: "5", parent: "4" },
        { key: "6", parent: "4" },
        { key: "7", parent: "Root" , dir: "left"},
        { key: "8", parent: "Root", dir: "right", color: yellowgrad },
        { key: "9", parent: "Root", group:"HIVE", dir:"right", loveid:"123" },
        { key: "10", parent: "9", group:"HIVE2-1",dir:"right" },
        { key: "11", parent: "9", group:"HIVE2-1",dir:"right" },
        { key: "12", parent: "9", group:"HIVE2-2" },
        { key: "13", parent: "Root", group:"HIVE"},
        { key: "14", parent: "Root", group:"HIVE"},
        { key: "15", parent: "Root", dir: "right", color: yellowgrad },
        { key: "16", parent: "15" },
        { key: "17", parent: "15" },
        { key: "18", parent: "1" },
        { key: "HIVE", parent: "Root", isGroup: true,dir:"right" },
        { key: "HIVE2-1", parent: "HIVE", isGroup: true },
        { key: "HIVE2-2", parent: "HIVE", isGroup: true }
      ];

    var links = [];
    
    for (let i = 0; i < model.length; i++) {
      var data = model[i];
      if (data.parent&&!data.group) links.push({ from: data.parent, to: data.key });
    };

    var myModel = new go.GraphLinksModel(model, links);

    myDiagram.model = myModel;

Lines between Groups or between Nodes can achieve this effect.But when I changed the parent of Group HIVE2-1 and HIVE2-2 from HIVE to 9, I wanted it to look like this:

image

But the reality is that Groups are not under my control.


I want each node in the group to generate a tree on its own.
Is there a good solution? :-)

1 post - 1 participant

Read full topic

Shape.figure ---Ring (Hollow is hard to select)

$
0
0

one
this is a hollow one. It’s good but when I click the center of it, and it’s very hard to select it
How can I select it easily as a solid one? some properties to change maybe?
Could you help me ?

1 post - 1 participant

Read full topic

External Button click change the shape dynamically

$
0
0

hi ,
Please provide some examples to add new node in the external button click to add Rectangle/Circle shape in the Go Js.

How to add dynamically node data to different shapes in the existing diagram.

myDiagram.startTransaction(“make new node”);
var node = go.GraphObject.make(
go.Node,
“Horizontal”,
{ key:“gamma”, locationSpot: go.Spot.Center, rotatable: true },
go.GraphObject.make(go.Shape, “Circle”, {
fill: “blue”,
stroke: null,
strokeWidth: 0,

      })
      )

myDiagram.model.addNodeData(node);
myDiagram.commitTransaction(“make new node”);

1 post - 1 participant

Read full topic

Diagram doesn't appear in bootstrap modal

Update group when groups member parts update

$
0
0

Hi,

We currently have a group template that runs a function when a part is added or removed from it, the function generates some label data from the children which is then added to the groups data to be rendered in the diagram. The jist of this function is it iterates over its member parts gets the names of all the parts from the part data and then builds a name string with this data which is then displayed as part of the group template in a textbox.

This works fine when adding and removing nodes from the group, however if any of the parts are updated (e.g. their name gets changed) the group label does not update. Is there a way of having this function run when any of the groups members update so that the group label reflects its members?

Thanks

4 posts - 2 participants

Read full topic

Viewing all 6926 articles
Browse latest View live