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

How to update Diagram on model property change without Data Inspector

$
0
0

Hello,
I am creating a diagram in Ext Js using Go Js. The diagram contains a few nodes.
I would like to do sth like this: https://gojs.net/latest/samples/orgChartEditor.html. Here goJs team using div and Inspector. I 'd use the Ext Js modal.

Clicking on the Node populates an Ext Js modal. The modal includes HTML input to update the diagram.model, and ‘OK’ button. After updating the data into the UI, we can update the diagram.model, but it is not updating the diagram on modal property change.

                    xtype: 'button',
                    text: 'OK',
                    handler: function () {
                        var tree = Ext.getCmp("tree-grid-script"),
                            key = editWindow.selectedNode.data.key,
                            node = tree.workflowDiagram.model.findNodeDataForKey(key);

                        tree.workflowDiagram.startTransaction('updateNode');
                        var text = editWindow.find('name', 'editor')[0].getValue();

                        tree.workflowDiagram.model.setDataProperty(node, "text", text);
                        tree.workflowDiagram.commitTransaction("update");

. Try both set and setDataProperty. Thanks in advance!

2 posts - 1 participant

Read full topic


Gojs如何动态开启或者关闭自动布局?

$
0
0

gojs如何通过一个外部按钮,来动态的开启或者关闭自动布局(layout)呢?…

1 post - 1 participant

Read full topic

Link flow over the node in force directed layout

$
0
0

I am using a force directed layout, and have 500 nodes and 2000 links, the links flows over the nodes making them hard to read, is there a way that all links flow the below the nodes, I saw a solution of setting layername : “Background” but i am not sure how and where to put it.

Thanks for the help !

2 posts - 2 participants

Read full topic

Use a React Component as a Node

$
0
0

Hi guys,
I read in the documentation that there is a method to use custom canvases as Node. (or even Chart.js since they return canvases)
But I’m trying to add/insert a React Component on the diagram. Either use it as a node or at least just insert it on the diagram.
Is there any built-in method to do this ?
Any suggestion and steps to do ?

2 posts - 2 participants

Read full topic

Trying to implement scrollable table

$
0
0

Hi,

I am trying to implement a scrollable table, much like record mapper, only the inner fields will be scrollable. I am using this with typescript and I imported the ScrollbarTable.ts file but I am facing this error

image

The code which is producing the error

Can you guys help me to figure out the issue?

2 posts - 2 participants

Read full topic

Remove Node Data Category

$
0
0

Is there a way to remove a node category completely? I have tried the following:

  1. This works but doesn’t update the model unless I refresh the page (I have tried adding node.updateTargetBindings() after it and it still doesn’t work):

    delete node.data.category;
    
  2. This changes the category to null but it still has the category property which breaks the model:

    m.set(node.data, "category", null);
    

Also, I am committing the changes to the model.

Thanks in advance for any help.

3 posts - 2 participants

Read full topic

Positioning inside table layout cell

$
0
0

I have the following structure:
go.Group (Table)

  • go.Panel (Auto)

It is possible to drag and drop nodes from other groups to this group, but I want to show those nodes “inside” the inner Panel, is that possible to achieve? If yes, what is the best way to achieve it?

1 post - 1 participant

Read full topic

How to change the colour of all the nodes on diagram click

$
0
0

When I am selecting a node i am changing the colour of the nodes which are connected from(green) and to(red) to the selected node, the default colour of all nodes on diagram load is blue, I am trying to change all the node colour to default if user clicks on empty space of the diagram.

is there a way to fill all node colour on mydiagram click ?

5 posts - 2 participants

Read full topic


ScrollingTable inside context menu

$
0
0

I am using a ScrollingTable inside context menu, everything works except scroll, when I try to scroll the list the context menu closes, is there a way to avoid this, or close context menu only on clicking outside of it ?

4 posts - 2 participants

Read full topic

GoJS version 2.1.20

$
0
0

Changes for 2.1.20

  • Fixed GraphLinksModel.setLabelKeysForLinkData sometimes disassociating a link’s label nodes that existed in both the old and new array.
  • Fixed the recording of model changes bound to a Part’s position or location , where they may not have been recorded in the undo manager when modifying the position , location , or desiredSize . This also fixes a regression from 2.1.14.
  • Fixed LinearGradient painting when used as a Shape.stroke. This drawing issue was most apparent when the Shape’s geometry was one-dimensional.
  • Fixed warning messages in Chrome about passive touch event listeners.
  • Fixed JumpOver and AvoidsNodes issues where ongoing animations might stop them from updating.

For previous releases see GoJS version 2.1.19

2 posts - 1 participant

Read full topic

Performance of mergeNodeDataArray method

$
0
0

I’m testing the new mergeNodeDataArray and mergeLinkDataArray for updating model data in React with Redux. It works fine for simple diagrams. However, when I feed them with larger amount of data, I noticed they are significantly slower than updating the model directly with data converters. One simple scenario: in a diagram with several hundred nodes, updating a field of a specific node with mergeNodeDataArray can take several hundred milliseconds while using a data converter to do the same update takes a few milliseconds. I’m not surprised to see that these new merge methods are slower because they have to go over the full model data, but I’d like to understand to what extend they are slower than the good old binding approach, their time complexity, and expected performance on complicated diagrams.

4 posts - 2 participants

Read full topic

Arranging nodes in a group

$
0
0

Hi,

Currently it seems the group bounds expand to fit the nodes within and the positions of the individual nodes are left in tact, but is it possible to arrange nodes within a group into a vertical grid? centering around a point on the diagram? And if its not possible with a group is it possible through some other means?

4 posts - 2 participants

Read full topic

Unable to reduce the panel spacing

$
0
0

I am trying to reduce the spacing between 2 panels

Screenshot 2020-07-08 at 17.56.38

I am not sure how to do that, here is the code I use -

this.$( go.Group, "Vertical",
			// @ts-ignore
			{
				selectionObjectName: "SHAPE",  // selecting a lane causes the body of the lane to be highlit, not the label
				resizable: false,
				ungroupable: true,
				canUngroup: true,
				layout: this.$( go.GridLayout,  // automatically lay out the lane's subgraph
					{
						wrappingColumn: 1,
						cellSize: new go.Size( 1, 1 ),
						spacing: new go.Size( 5, 5 ),
						alignment: go.GridLayout.Position,
						comparer: function ( a, b ) {  // can re-order tasks within a lane
							let ay = a.data.order;
							let by = b.data.order;
							if ( isNaN( ay ) || isNaN( by ) ) {
								return 0;
							}
							if ( ay < by ) {
								return -1;
							}
							if ( ay > by ) {
								return 1;
							}
							return 0;
						}
					} ),
				computesBoundsAfterDrag: true,  // needed to prevent recomputing Group.placeholder bounds too soon
				handlesDragDropForMembers: true,  // don't need to define handlers on member Nodes and Links
				mouseDragEnter: ( e, grp, prev ) => {
					// @ts-ignore
					if ( grp.canAddMembers( grp.diagram.selection ) ) {
						this.highlightGroup( grp, true );
					} else {
						grp.diagram.currentCursor = "not-allowed";
					}
				},
				mouseDragLeave: ( e, grp, next ) => {
					this.highlightGroup( grp, false );
				},
				mouseDrop: ( e, grp ) => {  // dropping a copy of some Nodes and Links onto this Group adds them to this Group
					// don't allow drag-and-dropping a mix of regular Nodes and Groups
					if ( e.diagram.selection.all( ( n ) => {
						return !(n instanceof go.Group);
					} ) ) {
						// @ts-ignore
						let ok = grp.addMembers( grp.diagram.selection, true );
						if ( !ok ) {
							grp.diagram.currentTool.doCancel();
						}
					}
				}
			},
			new go.Binding( "location", "loc", go.Point.parse ).makeTwoWay( go.Point.stringify ),
			// the lane header consisting of a TextBlock and an expander button
			this.$( go.Panel, "Horizontal",
				{
					name: "HEADER",
					angle: 0,  // maybe rotate the header to read sideways going up
					alignment: go.Spot.Left,
				},
				this.$( go.Panel, "Auto",
					this.$( go.Shape, ShapeLibraryHelperService.nodeStyle( '#cfd0d3', null, 162, 4 ) ),
					this.$( go.Panel, "Horizontal",
						{ alignment: go.Spot.Left },
						this.$( go.TextBlock, ShapeLibraryHelperService.textStyle( {
								name: "Section Header",
								editable: true,
								margin: new go.Margin( 15, 10, 15, 10 ),
								textValidation: true,
								font: 'bold 12px Roboto'
							} ),
							new go.Binding( "text", "text" ).makeTwoWay() )
					)
				),
			),  // end Horizontal Panel
			this.$( go.Panel, "Auto",  // the lane consisting of a background Shape and a Placeholder representing the subgraph
				this.$( go.Shape, "Rectangle", ShapeLibraryHelperService.nodeStyle( 'red', null, null, 4 ),
					new go.Binding( "fill", "isHighlighted", function ( h ) {
						return h ? "#D6D6D6" : "#F1F1F1";
					} ).ofObject(),
					new go.Binding( "desiredSize", "size", go.Size.parse ).makeTwoWay( go.Size.stringify ) ),
				this.$( go.Placeholder,
					{
						padding: 12,
						alignment: go.Spot.TopLeft
					}
				),
			),
		);

Thanks
Rory

2 posts - 2 participants

Read full topic

Update model on deleting a node in the diagram

$
0
0

Hi,
I need to update the model when trying to delete a node from the diagram. Can you please give me a reference where I could find this functionality in js? Also, while integrating the gojs angular sample project with my project I am getting this error


I did set the linkKeyProperty in GraphsLinkModel to the key that I require…but it is not working
image
If the angular version does not work, I need to switch to js. Any help would be appreciated…thanks in advance.

2 posts - 2 participants

Read full topic

Add a click event to the TextBlock of Instrument Gauge

$
0
0

Hi,
I’m trying to add another feature to this example of Instrument Gauge.
I want to change the value of the Graduated Panel when the user click on the number.
However, I’m not able to fire the click event of the TextBlock.
This is what I’m trying.
(I can see it is working if I add it to the Node title which is a TextBlock also)

$(go.TextBlock,
          { // each tick label
            interval: 4,
            alignmentFocus: go.Spot.Center,
            font: "bold italic 20pt sans-serif",
            stroke: "white",
            segmentOffset: new go.Point(0, 30),
            click: () => alert("You will never see this message.");
          })

Any idea how to achieve this ?

3 posts - 2 participants

Read full topic


makeImageData of diagram with background

$
0
0

Hello,

I would like to download an image of my diagram.
It works so far but by adding a background to my image, this one doesnt have the same size as my diagram
I tried to use different size, scale ect using makeImageData

4 posts - 2 participants

Read full topic

Diagram initial load with respect to a element

$
0
0

Hi,

I have align document to go.Spot.TopCenter, but sometime my first node/element is coming at top right corner or sometime top left corner. Similarly if the diagram is drawn from left to right , at that time I have align document to go.Spot.LeftCenter but but sometime my first node/element is coming at left top/bottom.

Is there any way in which I can make a particular element to come at centerTop or centerLeft.

Thanks in advance.

5 posts - 2 participants

Read full topic

Any plans for a vue-component

$
0
0

Hi,

I noticed that on the latest topics there are currently angular and react components for GoJS. Will this be extended to also cover Vue?

We already have a vue wrapper component in our project so its not too much of an issue for us if there is no plan for it but i’m mostly interested to see if there will be an official one released.

Thanks

2 posts - 2 participants

Read full topic

Node shape based on node array property

$
0
0

Hi,

in node array i have an object property type based on which I need to change the shape of the node.

nodes : [
{ name: “Name1” , key : “key1”, type: "Type1},
{ name: “Name2” , key : “key2”, type: "Type2}
]

I wan to display node as circle for type 1 and as square on type 2.

6 posts - 2 participants

Read full topic

Members added to a group don't share it's zOrder/layername/position

$
0
0

I have created a group of blocks that stick to the left edge of the diagram (i.e. horizontal scrolling) using the ViewportBoundsChanged event, however, when I add members to this group, the members tend to scroll independent of the group. Is there way to make sure that the added member nodes become a part of the group so that they also stick to the left edge during horizontal scroll?

6 posts - 2 participants

Read full topic

Viewing all 6926 articles
Browse latest View live