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

LayeredDigraphLayout Performance Suggestions

$
0
0

@dsirmans wrote:

Are there any suggested methods for increasing the performance of a LayeredDigraphLayout? This seems to be the only layout I can use due to the fact that the nodes in our diagrams can have lots of loops back to previous nodes. I have tried using TreeLayout and setting the routing to Orthagonal or AvoidsNodes to fix the way the links appear, but the links are still very confusing and overlap other nodes. The way that LayeredDigraphLayout lays out the diagram is very clean comparatively. The problem we are experiencing is that some of our diagrams are getting into 200+ nodes and growing. These diagrams can take nearly a minute to finally render. The same diagram in TreeLayout loads in about 4 seconds.

I am not currently using coordinates with my nodes. Would storing those and using them on render help out the performance in any way (keep the algorithm from having to determine where to position the nodes)? Any suggestions would be greatly appreciated.

Thanks

Posts: 6

Participants: 2

Read full topic


Creating several buttons on Inspector that shows details on clicking it

$
0
0

@kswamy15 wrote:

Hello,
I am creating nested data in the Nodes and I want to create a basic inspector that shows the main categories of the data as buttons and then when the user clicks on one of the buttons, shows more details that the user can change. One example is this https://gojs.net/temp/bindingSubProperties.html
But I want the details to be actually a button that will show the properties in the details variable in another inspector. I want to show a button and then add a button click function to the ‘details’ button that will open the 2nd inspector. I will have a bunch of variables like details - a series of buttons on the first inspector and it will show the detailed properties within those variables in the 2nd inspector. What changes do I need to make to the inspector.js to get this done?

Thanks.

Posts: 1

Participants: 1

Read full topic

How to select multiple nodes

$
0
0

@biswa wrote:

How to select multiple nodes using myDiagram.select() ?

My Code is:-

myDiagram.select(myDiagram.findNodeForKey(diagram_data[i].data.key));

I want multiple nodes selected by code.

Posts: 2

Participants: 2

Read full topic

Text Alignment in Table

$
0
0

@mopena wrote:

Not sure why my Hyperlink texts are not aligning in the center of the cells

var nodeShortcutTemplate =
$(go.Node, “Auto”,
{location: go.Point.parse(“3345 2500”), isLayoutPositioned: false},
$(go.Shape, {fill: “white”, stroke: “black”, strokeWidth: 3,alignment: go.Spot.Center }),
$(go.Panel, “Table”,
// Set defaults for all rows and columns:
{ defaultRowSeparatorStroke: “black”,
defaultColumnSeparatorStroke: “black”,
alignment: go.Spot.Center
},

    $(go.RowColumnDefinition,
      { column: 1, separatorStrokeWidth: 2, separatorStroke: "black" }),
    $(go.Panel, "Auto",
      { row: 0, column: 0, alignment: go.Spot.Center, width:450},
      $("HyperlinkText",
            function(node) { return node.data.anchor_url_link;},
            $(go.TextBlock, "Anchor Graphics & Captions", { font: "30px sans-serif", margin: 10})
       ),
    
     ),
     $(go.Panel, "Auto",
      { row: 0, column: 1,  alignment: go.Spot.Center, width:450},
      $("HyperlinkText",
        function(node) { return node.data.value_state_url_link;},
            $(go.TextBlock, "Value Statements", { font: "30px sans-serif", margin: 10})
      ),
    ),
    $(go.Panel, "Auto",
      { row: 1, column: 0,  alignment: go.Spot.Center, width:450 },
      $("HyperlinkText",
        function(node) { return node.data.spec_url_link;},
            $(go.TextBlock, "Specification Sheets", { font: "30px sans-serif", margin: 10 }),
       ),
    ),
    $(go.Panel, "Auto",
      { row: 1, column: 1,  alignment: go.Spot.Center, width:450 },
       $("HyperlinkText",
        function(node) { return node.data.prop_status_url_link;},
            $(go.TextBlock, "Proposal Status", { font: "30px sans-serif", margin: 10 })
        ),
        )
    ));

Posts: 3

Participants: 2

Read full topic

GoJS version 1.8.33

Need to give drop shadow to Panel inside of Part which also has drop shadow

$
0
0

@ironwill1023 wrote:

I need to give drop shadow to panel inside of Part. And Part has drop shadow too. I already gave drop shadow to Part. And I need to give different shadow to Panel inside of Part. How should I do that? Regards

Posts: 2

Participants: 2

Read full topic

Alignment/Stretch of row header in table panel

$
0
0

@Dominic.Lerbs wrote:

Hi,

I would like to add a header row to a table but avoid having a column index in the model.
Please see this example with a header row here: https://codepen.io/anon/pen/jQbrzq?editors=1010 (based on: https://gojs.net/latest/samples/records.html)
To assign the column captions to the column index within a TableRow, I need to set the column property. I have added a horizontal panel instead and added a binding from this panel to my columns array.
The columns are created in the horizontal panel, but the panel itself is not stretched to the full width of the parent.
If I set the columnSpan to 2, the horizontal panel is stretched to the correct width, but if I set it to 3 the width is wrong. Can you tell me where my mistake is?
Also, why do I need to set the columnSpan at all? Shouldn’t it be enough to set the stretch property of the horizontal panel to fill?

Posts: 3

Participants: 2

Read full topic

Is there a way to specify port "offsets"?

$
0
0

@michaelchann wrote:

I have a question about ports.

I can add a shape to my node template, position it, and have that be my port. This works great.
I can set a toSpot on my Link which will target a specific spot on that shape. This is also great.

What I can’t quite figure out how to do, is how to use an offset port spot inside of a shape that still does the smart thing where it ends the link line (and arrowhead, more importantly in my case) at the edge of the rendered shape.

Basically, when I set my shape to be my port, the links endpoint seems to be the center of the shape, but its length just hits the edge. This behavior is great.

What I would like, though, is to be able to specify (per link) a point or offset from center inside the port shape that retains this behavior of placing the ends / arrows of my link at the edge of the shape. If i specify a toSpot the automatic edge length behavior seems lost and the ends go right to the specified point regardless of where the edge is. I can’t use toShortLength because my shape is irregular and the link can come in from any angle.

Is this possible?

Posts: 1

Participants: 1

Read full topic


Strange zOrder / font behavior

$
0
0

@michaelchann wrote:

I have an interesting situation where I have some hover over handling on a node which changes the zOrder of a link connected to it. that link has a label in the way of a TextBlock. when I change the zOrder (either by manipulating the view object directly, or by way of a property binding) the font i have set sometimes falls off and I get the default font.

Calling diagram.layout(true) right before setting the zOrder seems to alleviate the problem, but this is pretty bad in my case for performance reasons.

I’m trying to whittle this down to something I can put on jsfiddle, but any help would be greatly appreciated until then. Thanks!

Posts: 1

Participants: 1

Read full topic

I'd like to change visibility of a panel when mouse over on or mouse leave off a picture. How to do it?

$
0
0

@ironwill1023 wrote:

This is the picture: https://monosnap.com/file/T4X84QwvM3uxTDf5d2uop5zDr9h6Ya
When I hover over the picture, I’d like to display overlay like this: https://monosnap.com/file/sPHAjEVCIkcWaJKX772t1aWluqajtY

And when mouse leaves, I’d like to hide overlay.

To do so, I already made picture and overlay panel:

        $(go.Picture,
          {
            name: "screenshot",
            desiredSize: new go.Size(193, 145),
          },
          new go.Binding("source", "screenshot"),
          {
            mouseOver: function(e, obj) {
           
            },
            mouseLeave: function(e, obj) {

            }
          }
        ),
        $(go.Panel, "Auto",
          {
            name: "hover-screenshot-panel",
            visible: false,
          },
          new go.Binding("visible", "visibilityOfPageFunctionPanel").ofModel(),
          $(go.Shape, "Rectangle",
            {
              name: "hover-bg",
              stroke: null,
              fill: "rgba(49, 67, 76, 0.9)" 
            }
          )
        )

(*Fyi, I’m building Angular project and I made separate ts file for node template.)
So how do I toggle visibility of overlay panel?
Regards

Posts: 7

Participants: 2

Read full topic

Create an empty table image

$
0
0

@ahmetgundogdu wrote:

Hello,
What should I do to create an image as the following in a Node template.
sampleTable

I want blank lines like in an image

Posts: 2

Participants: 2

Read full topic

How to create a custom ContextMenu

$
0
0

@Giosk wrote:

I created a custom adornment menu using the the defineBuilder with the objective to have buttons with the highlight disabled as you can see here:

 go.GraphObject.defineBuilder("ButtonWithoutHighlight", function(args) {
          const { name } = args[1]

          let button = $("Button", makeGObject(name))

          let border = button.findObject("ButtonBorder")
          if (border instanceof go.Shape) {
            border.stroke = null
            border.fill = "transparent"
          }

          button.mouseEnter = function(e, button, prev) {
            let shape = button.findObject("ButtonBorder")
            if (shape instanceof go.Shape) {
              border.stroke = null
              border.fill = "transparent"
            }
          }

          button.mouseLeave = function(e, button, prev) {
            let shape = button.findObject("ButtonBorder")
            if (shape instanceof go.Shape) {
              border.stroke = null
              border.fill = "transparent"
            }
          }

          return button
        })

        const makeGObject = function(name) {
          let SvgIcon

          switch (name) {
            case "map":
              SvgIcon = go.Geometry.parse(mapPath, true)
              break

            default:
              return $(go.TextBlock, name, {
                font: "bold 14pt sans-serif",
                stroke: "#fff",
                desiredSize: new go.Size(16, 16),
                textAlign: "center",
              })
          }

          const gObject = $(go.Shape, {
            column: 0,
            width: 16,
            height: 16,
            margin: 2,
            fill: "#fff",
            strokeWidth: 0,
            geometry: SvgIcon,
          })

          return gObject
        }

let $upperContextMenu = $(
      go.Panel,
      "Horizontal",

      $("ButtonWithoutHighlight", {
        name: "map",
        click: (e, obj) => {
          const contextmenu = obj.part
          const node = contextmenu.data
          console.log("aaaa", node)
        },
      }),

      $("ButtonWithoutHighlight", {
        name: "map",
        contextMenu: $(
          go.Adornment,
          "Vertical",
          new go.Binding("itemArray", "NavigationMaps"),
          {
            itemTemplate: $(
              "ContextMenuButton",
              $(
                go.TextBlock,
                {
                  stroke: "#fff",
                  background: IrionBlue,
                  textAlign: "center",
                  margin: 2,
                },
                new go.Binding("text", "NavigationMapName")
              ),
              {
                alignment: go.Spot.Right,
              }
            ),
          }
        ),

        click: (e, node) => e.diagram.commandHandler.showContextMenu(node),
      })
    )

    const adornmentMenu = $(
      go.Adornment,
      "Vertical",
      $(
        go.Panel,
        "Auto",
        { height: 18, alignment: new go.Spot(1, 0, -10, 0) },

        $(go.Shape, "RoundedTopRectangle", {
          fill: IrionBlue,
          stroke: IrionBlue,
        }),
        $upperContextMenu
      ),
      $(
        go.Panel,
        "Auto",
        $(go.Shape, "RoundedRectangle", {
          spot1: go.Spot.TopLeft,
          spot2: go.Spot.BottomRight,
          stroke: IrionBlue,
          strokeWidth: 2,
          fill: null,
        }),
        $(go.Placeholder, { margin: 1 })
      )
    )

Now I’d like to apply the same style at the buttons in the ContextMenu but this is the result.

navmap

Is it possible to apply the same style as I implemented in the “ButtonWithoutHighlight” for the ContextMenu buttons? I tried this way:

go.GraphObject.defineBuilder("ButtonNoHighlight", function(args) {
          const { name } = args[1]

          let button = $(
            "Button",
            $(go.TextBlock, name, {
              font: "bold 14pt sans-serif",
              stroke: "#fff",
              textAlign: "center",
            })
          )

          let border = button.findObject("ButtonBorder")
          if (border instanceof go.Shape) {
            border.stroke = null
            border.fill = "transparent"
          }

          button.mouseEnter = function(e, button, prev) {
            let shape = button.findObject("ButtonBorder")
            if (shape instanceof go.Shape) {
              border.stroke = null
              border.fill = "transparent"
            }
          }

          button.mouseLeave = function(e, button, prev) {
            let shape = button.findObject("ButtonBorder")
            if (shape instanceof go.Shape) {
              border.stroke = null
              border.fill = "transparent"
            }
          }

          return button
        })

and then I used

$("ButtonWithoutHighlight", {
            name: "map",
            contextMenu: $(
              go.Adornment,
              "Vertical",
              new go.Binding("itemArray", "NavigationMaps"),
              {
                itemTemplate: $(
                  "ContextMenuButton",
                  $("ButtonNoHighlight", {
                    name: "mymapelement",
                    click: (e, obj) => {},
                  })
                ),
              }
            ),

            click: (e, node) => e.diagram.commandHandler.showContextMenu(node),
          })

but the result doesn’t take the binding new go.Binding("text", "NavigationMapName")

navmap2

What do I have to do?

Posts: 6

Participants: 2

Read full topic

Is possible use two shapes in a node?

$
0
0

@agv wrote:

I using version 1.8.32 and google chrome as a browser.

I have this estructure as nodetemplate:

-node
   -shape(white)
   -shape(black)

Because i want to show the node in this way:
finaltrack

The same shape with different colors and strokewidth to simulate a hollow segment

But this is the result:

track

The black segment doesn t exist.

I tried with another white shape (ones with a close figure, not only segments) and this is the result:

bridge

        // this is the figure generator for both segments (black and white)

    if (shape !== null) {
        var param1 = shape.parameter1;
        if (!isNaN(param1) && param1 >= 0) p1 = param1; // can't be negative or NaN
    }
    var geo = new go.Geometry();
     var startX = 0;
    var startY = 0;
    var endX = w;
    var endY = 0;
    geo.add(new go.PathFigure(startX, startY)
        .add(new go.PathSegment(go.PathSegment.Line, endX, endY).close()));
 
    return geo;

Why the second one had the black segment and the first doesn t have?

Posts: 6

Participants: 2

Read full topic

I'd like to add animation like this video

$
0
0

@ironwill1023 wrote:

hi, plz see this video:

I want animation like this video when arrange nodes, zoom in and zoom out.
For now, I made this functions:
// Align
onClickAlign() {
this.editDiagram.layout.doLayout(this.editDiagram);
}

// Zoom in
onClickZoomIn() {
this.editDiagram.commandHandler.increaseZoom(1.5);
}

// Zoom out
onClickZoomOut() {
this.editDiagram.commandHandler.decreaseZoom(2/3);
}

These are working without any animation.
How can I add animation like video?
Regards

Posts: 7

Participants: 3

Read full topic

How to draw a new links and setting data while doing it

$
0
0

@Giosk wrote:

Hi Walter,
following this example I tried to draw a link between two of my entities, but with some issues.
I tried to follow this post but with no result.

The code to draw the link is the same as the above example

const drawLink = (e, button) => {
  var node = button.part.adornedPart
  var tool = e.diagram.toolManager.linkingTool
  tool.startObject = node.port
  e.diagram.currentTool = tool
  tool.doActivate()
}

I’ve add to my diagram these options and the linkConnected callback

  fromLinkable: true,
  fromLinkableDuplicates: true, 

  toLinkable: true,
  toLinkableDuplicates: true, 

  linkConnected: (node, link, port) => {
    if (link.fromNode !== null) {
      link.fromNode.invalidateConnectedLinks()
    }
    if (link.toNode !== null) {
      link.toNode.invalidateConnectedLinks()
    }
   }

and I also wrote this piece of code to handle the event of drawing a new link

myDiagram.addDiagramListener("LinkDrawn", e => {
  const subject = e.subject
  const { from, to } = subject.data
  const fromEntity = myDiagram.findPartForKey(from)
  const toEntity = myDiagram.findPartForKey(to)
  ....
})

in the “LinkDrawn” listener I get the “fromEntity” and “toEntity” in order to do a post to my server and store in my db my new link.

When I draw a link between two entities, I have the issue that after the drawing phase, the arrow goes to an empty place and I get this error:

Uncaught TypeError: Cannot read property 'LinkId' of null
    at selectionChanged (VM38 bundle.js:114665)
    at X.<anonymous> (VM38 bundle.js:21707)
    at E../node_modules/gojs/release/go.js.E.select.E.select (VM38 bundle.js:21011)
    at Vj../node_modules/gojs/release/go.js.qg.standardMouseSelect (VM38 bundle.js:20658)
    at Vj../node_modules/gojs/release/go.js.Vj.doMouseUp (VM38 bundle.js:20792)
    at hh../node_modules/gojs/release/go.js.hh.doMouseUp (VM38 bundle.js:20851)
    at E../node_modules/gojs/release/go.js.E.doMouseUp (VM38 bundle.js:20923)

I can’t find where is the problem and to be honest I didn’t understand how it works the tool for drawing the link.
Thanks

Posts: 3

Participants: 3

Read full topic


I'd like to draw Bezier link between nodes

$
0
0

@ironwill1023 wrote:

I’d like to draw Bezier link between nodes like this video:

But I could only draw straight links in gojs.
How to draw bezier links in gojs?
Regards

Posts: 1

Participants: 1

Read full topic

Tree Mapper Sample - links

$
0
0

@leewsimpson wrote:

In the sample - the links go all the way to the nodes:
2018-11-11_17-50-35

but when running (in chrome) the links only make it to the group:
2018-11-11_17-48-58

How do you change the behaviour to be that of the first image?

Posts: 1

Participants: 1

Read full topic

How to delete Links Between nodes based on comparing FROM and TO node's data

$
0
0

@ganesh wrote:

Hi ,

In my requirement i want to delete links between nodes
based on the other end node data i want to delete respective link between that nodes but i dont want to delete all links between them only one which doesnt satisfy FROM node data in TO node then i need to delete that respective link. How can i do this in Gojs…??

can we delete links based on their keys ???

Thanks & Regards,
Ganesh.

Posts: 1

Participants: 1

Read full topic

How to make a graduated panel stretch to full width of the diagram?

$
0
0

@Lucian wrote:

Hello,

I am trying to make a graduated panel extend to the full width of the diagram, which is resized together with the window. I used the thermometer and the rulers examples and I am binding the width of the line to the width of the node and I am updating the width of the node at ViewportBoundsChanged with setDataProperty(node, ‘width’, vb.width).

My node template is this:

$(go.Node, 'Graduated', {
        graduatedTickUnit: 10,
        pickable: false,
        layerName: 'Foreground',
        isInDocumentBounds: false,
        isAnimated: false
    },
    $(go.Shape, { geometryString: 'M0 0 H1000' }, new go.Binding('width')),
    $(go.Shape, { geometryString: 'M0 0 V20', interval: 1 }),
    $(go.TextBlock, {
        font: '10px sans-serif',
        interval: 1,
        alignmentFocus: go.Spot.TopLeft,
        segmentOffset: new go.Point(1, 1),
        graduatedFunction: function(n) {
            const value = new Date(n * 100);

            return new Intl.DateTimeFormat(navigator.language, {
                    year: 'numeric',
                    month: 'numeric',
                    day: 'numeric'}).format(value)
                + '\n'
                + new Intl.DateTimeFormat(navigator.language, {
                    hour: 'numeric',
                    minute: 'numeric',
                    second: 'numeric'
                }).format(value);
        }
    })
);

Why does my node stay 1000px wide and doesn’t expand further than that?

Best,
Lucian

Posts: 1

Participants: 1

Read full topic

Using GoJS in unit tests

$
0
0

@tswistak wrote:

Hi,

Since GoJS 2.0 has support for browser-less environments like Node, I decided to incorporate some unit tests for our diagram handling functions. However, I am unable to use it - I get following error:

TypeError: Cannot set property ‘fillStyle’ of null
at node_modules/gojs/release/go.js:828:107
at Object. (node_modules/gojs/release/go.js:2076:265)

I’m running unit tests through Jest with TypeScript. Here’s the code of sample unit test using GoJS that doesn’t work:

import * as go from 'gojs';
const $ = go.GraphObject.make;
const myPalette = $(go.Palette, '', { viewSize: new go.Size(100, 100) });
const model = [
    { key: 'A', group: '' }
];
myPalette.model = new go.GraphLinksModel(model);    
describe('palette', () => {
    test('should have nodedataarray created from model', () => {
        expect(myPalette.model.nodeDataArray).toHaveLength(model.length);
    });
});

Do you have any idea why this error is thrown and what we can do to be able to use GoJS functionalities through Jest?

I’m using GoJS from NPM, version “2.0.0-beta6”. Version of Jest is “23.6.0”, and ts-jest “23.10.4”.

Posts: 1

Participants: 1

Read full topic

Viewing all 6977 articles
Browse latest View live


Latest Images