GraphObject class
This is the abstract base class for all graphical objects. Classes inheriting from GraphObject include: Shape, TextBlock, Picture, and Panel. From the Panel class the Part class is derived, from which the Node and Link classes derive.
It is very common to make use of the static function GraphObject.make in order to build up a visual tree of GraphObjects. You can see many examples of this throughout the Introduction, starting at Building Objects, and the Samples, starting with Minimal Sample.
Since GraphObject is an abstract class, programmers do not create GraphObjects themselves, but this class defines many properties used by all kinds of GraphObjects.
The only visual property on GraphObject is #background. However one can control whether the GraphObject is drawn at all by setting #visible, or by setting #opacity to zero if you still want the GraphObject to occupy space. Call the #isVisibleObject predicate to determine whether the object is visible and all of its containing panels are visible. Also, if you want to control whether any mouse or touch events "see" the GraphObject, you can set #pickable to false.
For more information about specifying how things get drawn, see the properties on the Shape, TextBlock, and Picture classes.
GraphObject Sizing
GraphObject defines most of the properties that cause objects to size themselves differently. The most prominent ones include:
- The #desiredSize, #minSize, and #maxSize properties are used to explicitly set or limit the size of visual elements. #width and #height are convenience properties that set the #desiredSize width and height, respectively.
- The #angle and #scale properties are used to transform visual elements.
- The #stretch property determines how a GraphObject will fill its visual space, contextually granted to it by its containing Panel. Top-level (Part) GraphObjects are not affected by this property because they are always granted infinite space.
All GraphObjects in a Diagram are measured and then arranged by their containing Panels in a tree-like fashion. After measuring and arranging, a GraphObject will have valid values for the read-only properties #naturalBounds, #measuredBounds, and #actualBounds.
- The #naturalBounds of a GraphObject describe its local size, without any transformations (#scale, #angle) affecting it.
- The #measuredBounds of a GraphObject describe its size within its containing Panel.
- The #actualBounds of a GraphObject describe its position and given size inside of its panel. This size may be smaller than #measuredBounds, for instance if a GraphObject with a large #desiredSize is placed in a Panel of a smaller #desiredSize. Smaller #actualBounds than #measuredBounds typically means an object will be cropped.
See the Introduction page on sizing for usage information and examples.
GraphObject Size and Position within Panel
Several GraphObject properties guide the containing Panel for how to size and position the object within the panel.- The #alignment specifies where the object should be relative to some area of the panel. For example, an alignment value of Spot.BottomRight means that the GraphObject should be at the bottom-right corner of the panel.
- The #alignmentFocus specifies precisely which point of the GraphObject should be aligned at the #alignment spot.
- The #column and #row properties are only used by Panel.Table panels, to indicate where the GraphObject should be.
- The #columnSpan and #rowSpan properties tell the Panel.Table panel how large the GraphObject should be.
- The #isPanelMain property indicates to some kinds of Panels that the GraphObject is the "primary" object that other panel children should be measured with or positioned in.
- The #margin property tells the containing Panel how much extra space to put around this GraphObject.
- The #position property is used to determine the relative position of GraphObjects when they are elements of a Panel.Position panel.
See the Introduction page on Panels and Table Panels for an overview of the capabilities.
Top-level GraphObjects are Parts
A Part is a derived class of GraphObject representing a top-level object. All top-level GraphObjects must be Parts, and Node, Link, Group, and Adornment derive from Part. The position of a Part determines the point of the Part's top-left corner in document coordinates. See also Part#location, which supports an way to specify the position based on a different spot of a different element within the Part.
There are several read-only properties that help navigate up the visual tree.
- #panel returns the Panel that directly contains this GraphObject
- #part returns the Part that this GraphObject is in, perhaps via intervening Panels; this is frequently used in order to get to the model data, Panel#data
- #layer returns the Layer that this GraphObject's Part is in
- #diagram returns the Diagram that this GraphObject's Part's Layer is in
See the Visual Tree sample for a diagram displaying the visual tree of a simple diagram.
User Interaction
GraphObjects have several properties enabling dynamic customizable interaction. There are several definable functions that execute on input events: #mouseDragEnter, #mouseDragLeave, #mouseDrop, #mouseEnter, #mouseHold, #mouseHover, #mouseLeave, and #mouseOver. For example, you could define mouse enter-and-leave event handlers to modify the appearance of a link as the mouse passes over it:
myDiagram.linkTemplate =
$(go.Link,
$(go.Shape,
{ strokeWidth: 2, stroke: "gray" }, // default color is "gray"
{ // here E is the InputEvent and OBJ is this Shape
mouseEnter: (e, obj) => { obj.strokeWidth = 4; obj.stroke = "dodgerblue"; },
mouseLeave: (e, obj) => { obj.strokeWidth = 2; obj.stroke = "gray"; }
}));
There are #click, #doubleClick, and #contextClick functions that execute when a user appropriately clicks the GraphObject. These click functions are called with the InputEvent as the first argument and this GraphObject as the second argument. For example, you could define a click event handler on a Node that goes to another page:
myDiagram.nodeTemplate =
$(go.Node, "Auto",
$(go.Shape, "RoundedRectangle",
new go.Binding("fill", "color")),
$(go.TextBlock,
{ name: "TB", margin: 3 },
new go.Binding("text", "key")),
{ // second arg will be this GraphObject, which in this case is the Node itself:
click: (e, node) => {
window.open("https://en.wikipedia.org/Wiki/" + node.data.key);
}
});
Note: you may prefer defining DiagramEvent listeners on the Diagram rather than on individual GraphObjects. DiagramEvents also include more general events that do not necessarily correspond to input events.
The properties #actionCancel, #actionDown, #actionMove, and #actionUp define functions to execute when the GraphObject's #isActionable property is set to true (default false). See the ActionTool for more detail.
See the Introduction page on Events for a more general discussion.
GraphObjects as Ports
In GoJS, Links can only connect to elements within a Node that are specified as "ports", and by default the only port is the Node itself. Setting the #portId of a GraphObject inside a Node allows that object to act as a port. Note: the only kind of model that can save which port a link is connected with, i.e. portIds that are not an empty string, is a GraphLinksModel whose GraphLinksModel#linkFromPortIdProperty and GraphLinksModel#linkToPortIdProperty have been set to name properties on the link data objects.
GraphObjects have several properties that are only relevant when they are acting as ports. These port-related properties are:
- #portId, which must be set to a string that is unique within the Node, in order for this GraphObject to be treated as a "port", rather than the whole node
- #fromSpot and #toSpot, where a link should connect with this port
- #fromEndSegmentLength and #toEndSegmentLength, the length of the link segment adjacent to this port
- #fromShortLength and #toShortLength, the distance the link should terminate before touching this port
- #fromLinkable and #toLinkable, whether the user may draw links connecting with this port
- #fromLinkableDuplicates and #toLinkableDuplicates, whether the user may draw multiple links between the same pair of ports
- #fromLinkableSelfNode and #toLinkableSelfNode, whether the user may draw a link between ports on the same node
- #fromMaxLinks and #toMaxLinks, to limit the number of links connecting with this port in a particular direction
See the Introduction page on ports and link routing and link connection points for port usage information and examples.
GraphObjects as labels on a Link
GraphObjects can also be used as "labels" on a Link. In addition to the #alignmentFocus property, these properties direct a Link Panel to position a "label" at a particular point along the route of the link, in a particular manner:
- #segmentIndex, which segment the label should be on
- #segmentFraction, how far along the segment the label should be
- #segmentOffset, where the label should be positioned relative to the segment
- #segmentOrientation, how the label should be rotated relative to the angle of the segment
See the Introduction page on link labels for examples of how to make use of labels on Links.
Interactive Behavior
There are several properties that specify fairly high-level interactive behavior:
- #cursor, a CSS string specifying a cursor
- #contextMenu, an Adornment
- #toolTip, an Adornment
For more information, please read the Introduction page about Context Menus and the page about ToolTips.
Also see the Basic sample for examples of how to show context menus and tooltips.
- Implementers
- Available extensions
- Annotations
-
- @JS()
- @staticInterop
Constructors
- GraphObject()
-
factory
Properties
- actionCancel ↔ void Function(InputEvent, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when the ActionTool is cancelled and this GraphObject's #isActionable is set to true. This property is infrequently set. By default this property is null.getter/setter pair - actionDown ↔ void Function(InputEvent, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute on a mouse-down event when this GraphObject's #isActionable is set to true. This property is infrequently set. By default this property is null.getter/setter pair - actionMove ↔ void Function(InputEvent, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute on a mouse-move event when this GraphObject's #isActionable is set to true. This property is infrequently set. By default this property is null.getter/setter pair - actionUp ↔ void Function(InputEvent, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute on a mouse-up event when this GraphObject's #isActionable is set to true. This property is infrequently set. By default this property is null.getter/setter pair - actualBounds ↔ Rect
-
Available on GraphObject, provided by the GraphObject$Typings extension
This read-only property returns the bounds of this GraphObject in container coordinates. This means that the actualBounds are in the coordinate space of the GraphObject's Panel, unless this is a Part, in which case they are in the Diagram's coordinate system.getter/setter pair - alignment ↔ Spot
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the alignment Spot of this GraphObject used in Panel layouts, to determine where in the area allocated by the panel this object should be placed.getter/setter pair - alignmentFocus ↔ Spot
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the spot on this GraphObject to be used as the alignment point in Spot and Fixed Panels. Value must be of the Spot.getter/setter pair - angle ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the angle transform, in degrees, of this GraphObject. Value must be a number. If the value is not between (0 <= value < 360), it will be normalized to be in that range. Zero is along the positive X-axis (rightwards); 90 is along the positive Y-axis (downwards). Default is 0.getter/setter pair - areaBackground ↔ dynamic
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the areaBackground Brush of this GraphObject. The areaBackground fills the rectangle described by this GraphObject's containing panel's coordinates. If the object is rotated, the area background will expand to fill the entire measured bounds of the object, without rotating the brush.getter/setter pair - background ↔ dynamic
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the background Brush of this GraphObject, filling the rectangle of this object's local coordinate space. If the object is rotated, the background will rotate with it.getter/setter pair - bind → ({GraphObject Function(Binding binding) $1, GraphObject Function([String? targetprop, String? sourceprop, TargetConversion? conv, BackConversion? backconv]) $2})
-
Available on GraphObject, provided by the GraphObject$Typings extension
Overload accessor: $1, $2no setter - click ↔ void Function(InputEvent, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when the user single-primary-clicks on this object. This typically involves a mouse-down followed by a prompt mouse-up at approximately the same position using the left (primary) mouse button. This property is used by the ClickSelectingTool when the user clicks on a GraphObject. The function is called in addition to the DiagramEvent that is raised with the name"ObjectSingleClicked"
.getter/setter pair - column ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the column of this GraphObject if it is in a Table Panel. The value must be a small non-negative integer. The default is 0.getter/setter pair - columnSpan ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the number of columns spanned by this GraphObject if it is in a Table Panel. The value must be a small positive integer. The default is 1.getter/setter pair - contextClick ↔ void Function(InputEvent, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when the user single-secondary-clicks on this object. This typically involves a mouse-down followed by a prompt mouse-up at approximately the same position using the right (secondary) mouse button. This property is used by the ClickSelectingTool when the user clicks on a GraphObject. The function is called in addition to the DiagramEvent that is raised with the name"ObjectContextClicked"
.getter/setter pair - contextMenu ↔ dynamic
-
Available on GraphObject, provided by the GraphObject$Typings extension
This Adornment or HTMLInfo is shown upon a context click on this object. The default value is null, which means no context menu is shown.getter/setter pair - cursor ↔ String
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the mouse cursor to use when the mouse is over this object with no mouse buttons pressed. The value is null when no particular cursor is specified for this object; the actual cursor is determined by any containing Panel.getter/setter pair - desiredSize ↔ Size
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the desired size of this GraphObject in local coordinates. Value must be of type Size. Default is Size(NaN, NaN). You cannot modify the width or height of the value of this property -- if you want to change the desiredSize you must set this property to a different Size.getter/setter pair - diagram ↔ Diagram?
-
Available on GraphObject, provided by the GraphObject$Typings extension
This read-only property returns the Diagram that this GraphObject is in, if it is.getter/setter pair - doubleClick ↔ void Function(InputEvent, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when the user double-primary-clicks on this object. This typically involves a mouse-down/up/down/up in rapid succession at approximately the same position using the left (primary) mouse button. This property is used by the ClickSelectingTool when the user clicks on a GraphObject. The function is called in addition to the DiagramEvent that is raised with the name"ObjectDoubleClicked"
.getter/setter pair - enabledChanged ↔ void Function(GraphObject, bool)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when some containing Panel changes the value of Panel#isEnabled. It is typically used to modify the appearance of the object. This function must not change the value of any panel Panel#isEnabled.getter/setter pair - filter ↔ String
-
Available on GraphObject, provided by the GraphObject$Typings extension
Undocumented. May not work in Safari.getter/setter pair - fromEndSegmentLength ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the length of the first segment of a link coming from this port. This value is used when the computed "from spot" is not Spot.None. The default value is 10. This value also limits how short the Link#fromShortLength may be drawn.getter/setter pair - fromLinkable ↔ bool?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets whether the user may draw Links from this port. This property is used by LinkingBaseTool#isValidFrom.getter/setter pair - fromLinkableDuplicates ↔ bool
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets whether the user may draw duplicate Links from this port. This property is used by LinkingBaseTool#isValidLink. The default value is false.getter/setter pair - fromLinkableSelfNode ↔ bool
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets whether the user may draw Links that connect from this port's Node. This property is used by LinkingBaseTool#isValidLink. The default value is false.getter/setter pair - fromMaxLinks ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the maximum number of links that may come out of this port. This property is used by LinkingBaseTool#isValidFrom.getter/setter pair - fromShortLength ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets how far the end segment of a link coming from this port stops short of the actual port. Positive values are limited by the #fromEndSegmentLength or Link#fromEndSegmentLength. Negative values cause the link to extend into the port. The default value is zero.getter/setter pair - fromSpot ↔ Spot
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets where a link should connect from this port. The default value is Spot.None, meaning that the link routing must consider the shape of the port and connect at the closest point.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
- height ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the desired height of this GraphObject in local coordinates. This just gets or sets the height component of the #desiredSize. Default is NaN.getter/setter pair - isActionable ↔ bool
-
Available on GraphObject, provided by the GraphObject$Typings extension
This property determines whether or not this GraphObject's events occur before all other events, including selection. This enables the #actionDown, #actionMove, #actionUp, and #actionCancel events, which are all handled by the ActionTool.getter/setter pair - isPanelMain ↔ bool
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets whether a GraphObject is the "main" object for some types of Panel. Panels that use a "main" object include Panel.Auto, Panel.Spot, and Panel.Link.getter/setter pair - layer ↔ Layer?
-
Available on GraphObject, provided by the GraphObject$Typings extension
This read-only property returns the GraphObject's containing Layer, if there is any. A plain GraphObject cannot belong directly to a Layer -- only a Part can belong directly to a Layer.getter/setter pair - margin ↔ Object
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the size of empty area around this GraphObject, as a Margin, in the containing Panel coordinates.getter/setter pair - maxSize ↔ Size
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the maximum size of this GraphObject in container coordinates (either a Panel or the document). Any new value must be of type Size; NaN values are treated as Infinity. If you want no maximum width or height, use NaN or Infinity.getter/setter pair - measuredBounds ↔ Rect
-
Available on GraphObject, provided by the GraphObject$Typings extension
This read-only property returns the measuredBounds of the GraphObject in container coordinates (either a Panel or the document). This describes the transformed bounds with margins excluded.getter/setter pair - minSize ↔ Size
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the minimum size of this GraphObject in container coordinates (either a Panel or the document). Any new value must be of type Size; NaN values are treated as 0.getter/setter pair - mouseDragEnter ↔ void Function(InputEvent, GraphObject, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when the user moves the mouse into this stationary object during a DraggingTool drag; this allows you to provide feedback during a drag based on where it might drop.getter/setter pair - mouseDragLeave ↔ void Function(InputEvent, GraphObject, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when the user moves the mouse out of this stationary object during a DraggingTool drag; this allows you to provide feedback during a drag based on where it might drop.getter/setter pair - mouseDrop ↔ void Function(InputEvent, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when a user drops the selection on this object at the end of a DraggingTool drag; this allows you to customize the behavior when a drop occurs on an object.getter/setter pair - mouseEnter ↔ void Function(InputEvent, GraphObject, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when the user moves the mouse into this object without holding down any buttons. This property is used by the ToolManager.getter/setter pair - mouseHold ↔ void Function(InputEvent, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when the user holds the mouse still for a while over this object while holding down a button. This property is used by the ToolManager.getter/setter pair - mouseHover ↔ void Function(InputEvent, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when the user holds the mouse still for a while over this object without holding down any buttons. This property is used by the ToolManager.getter/setter pair - mouseLeave ↔ void Function(InputEvent, GraphObject, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when the user moves the mouse out of this object without holding down any buttons. This property is used by the ToolManager.getter/setter pair - mouseOver ↔ void Function(InputEvent, GraphObject)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the function to execute when the user moves the mouse over this object without holding down any buttons. This property is used by the ToolManager. This property is infrequently used -- it is more common to implement #mouseEnter and #mouseLeave functions.getter/setter pair - name ↔ String
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the name for this object. The default value is the empty string. The name should be unique within a Panel, although if it isn't, it reduces the usefulness of methods such as Panel#findObject.getter/setter pair - naturalBounds ↔ Rect
-
Available on GraphObject, provided by the GraphObject$Typings extension
This read-only property returns the natural bounding rectangle of this GraphObject in local coordinates, before any transformation by #scale or #angle. Defaults to unknown (NaN,NaN).getter/setter pair - opacity ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the multiplicative opacity for this GraphObject and (if a Panel) all elements. The value must be between 0.0 (fully transparent) and 1.0 (no additional transparency).getter/setter pair - panel ↔ Panel?
-
Available on GraphObject, provided by the GraphObject$Typings extension
This read-only property returns the GraphObject's containing Panel, or null if this object is not in a Panel.getter/setter pair - part ↔ Part?
-
Available on GraphObject, provided by the GraphObject$Typings extension
This read-only property returns the Part containing this object, if any. The Part will be the root GraphObject in this GraphObject's visual tree.getter/setter pair - pickable ↔ bool
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets whether or not this GraphObject can be chosen by visual "find" or "hit-test" methods such as Diagram#findObjectAt.getter/setter pair - portId ↔ String
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets an identifier for an object acting as a port on a Node. The default value is null -- this object is not a port.getter/setter pair - position ↔ Point
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the position of this GraphObject in container coordinates (either a Panel or the document). Value must be of type Point. You cannot modify the x or y of the value of this property -- if you want to change the position you must set this property to a different Point. Default isPoint(NaN, NaN)
.getter/setter pair - row ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the row of this GraphObject if it is in a Table Panel. The value must be a small non-negative integer. The default is 0.getter/setter pair - rowSpan ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the number of rows spanned by this GraphObject if it is in a Table Panel. The value must be a small positive integer. The default is 1.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scale ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the scale transform of this GraphObject. Value must be a number; larger values will make this object appear bigger. Default is 1.getter/setter pair - segmentFraction ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the fractional distance along a segment of a GraphObject that is in a Link. The value should be between zero and one, where zero is at the point at the start of the segment, and where one is at the point at the end of the segment. The default value is zero.getter/setter pair - segmentIndex ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the segment index of a GraphObject that is in a Link. Non-negative numbers count up from zero, which is the first segment, at the "from" end of the Link. Negative numbers count segments from the "to" end of the Link, where -1 means the last segment and -2 means the next-to-last segment. The default value is -Infinity. The value should be an integer or NaN.getter/setter pair - segmentOffset ↔ Point
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the offset of a GraphObject that is in a Link from a point on a segment or in a Panel.Graduated from a point along the main element. The X component of the Point indicates the distance along the route, with positive values going further toward the "to" end of the link or panel. The Y component of the Point indicates the distance away from the route, with positive values towards the right as seen when facing further towards the "to" end of the link or panel. The value defaults to the Point (0, 0). You cannot modify the x or y of the value of this property -- if you want to change the segmentOffset you must set this property to a different Point.getter/setter pair - segmentOrientation ↔ EnumValue
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the orientation of a GraphObject that is in a Link or Panel.Graduated. This controls the automatic rotation of the object by the Link Panel or Graduated Panel. The only accepted values are the Link "Orient..." values of Link and the default value: Link.None.getter/setter pair - shadowVisible ↔ bool?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets whether or not this GraphObject will be shadowed inside a Part that has Part#isShadowed set to true.getter/setter pair - spanAllocation ↔ num Function(GraphObject, RowColumnDefinition, num)?
-
Available on GraphObject, provided by the GraphObject$Typings extension
(undocumented)getter/setter pair - stretch ↔ EnumValue
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the stretch of the GraphObject. This controls whether the width and/or height of this object automatically adjusts to fill the area allotted by the containing Panel.getter/setter pair - toEndSegmentLength ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the length of the last segment of a link going to this port. This value is used when the computed "to spot" is not Spot.None. The default value is 10.getter/setter pair - toLinkable ↔ bool?
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets whether the user may draw Links to this port. This property is used by LinkingBaseTool#isValidTo.getter/setter pair - toLinkableDuplicates ↔ bool
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets whether the user may draw duplicate Links to this port. This property is used by LinkingBaseTool#isValidLink. The default value is false.getter/setter pair - toLinkableSelfNode ↔ bool
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets whether the user may draw Links that connect to this port's Node. This property is used by LinkingBaseTool#isValidLink. The default value is false.getter/setter pair - toMaxLinks ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the maximum number of links that may go into this port. This property is used by LinkingBaseTool#isValidTo.getter/setter pair - toolTip ↔ dynamic
-
Available on GraphObject, provided by the GraphObject$Typings extension
This Adornment or HTMLInfo is shown when the mouse hovers over this object. The default value is null, which means no tooltip is shown.getter/setter pair - toShortLength ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets how far the end segment of a link going to this port stops short of the actual port. Positive values are limited by the #toEndSegmentLength or Link#toEndSegmentLength. Negative values cause the link to extend into the port. The default value is zero.getter/setter pair - toSpot ↔ Spot
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets where a link should connect to this port. The default value is Spot.None, meaning that the link routing must consider the shape of the port and connect to the closest point.getter/setter pair - visible ↔ bool
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets whether a GraphObject is visible. The default value is true. A not visible object takes no space in the Panel that it is in. Toggling visibility may cause elements in the visual tree to re-measure and re-arrange. Making a Panel not visible causes all of its elements not to be seen or receive input events. Changing a Panel to become visible causes all of its elements to be seen and be active, unless those elements are themselves not visible.getter/setter pair - width ↔ num
-
Available on GraphObject, provided by the GraphObject$Typings extension
Gets or sets the desired width of this GraphObject in local coordinates. This just gets or sets the width component of the #desiredSize. Default is NaN.getter/setter pair
Methods
-
apply(
void func(GraphObject)) → GraphObject -
Available on GraphObject, provided by the GraphObject$Typings extension
This method takes a function that can be used to apply multiple settings, bindings, or Panel#add calls, to different GraphObjects. This is common in initialization. If you are just adding settings, bindings, or GraphObjects to a single GraphObject, you do not need to use this, you can just chain calls to #set, #bind, and Panel#add instead. This method is mostly useful when setting the same values across multiple GraphObjects. -
attach(
[dynamic config]) → GraphObject -
Available on GraphObject, provided by the GraphObject$Typings extension
This method sets a collection of properties according to the property/value pairs on the given Object, or array of Objects, in the same manner as GraphObject.make does when constructing a GraphObject. -
cloneProtected(
GraphObject copy) → void -
Available on GraphObject, provided by the GraphObject$Typings extension
Copies properties from this object to the given object, which must be of the same class. This is called by #copy. This method may be overridden. -
copy(
) → GraphObject -
Available on GraphObject, provided by the GraphObject$Typings extension
Creates a deep copy of this GraphObject and returns it. This method is the same as a clone for simple GraphObjects such as Shape, TextBlock, and Picture. For Panel this method copies the visual tree of GraphObjects that it contains. @expose @return {GraphObject} -
findBindingPanel(
) → Panel? -
Available on GraphObject, provided by the GraphObject$Typings extension
Walks up the visual tree and returns the first Panel whose Panel.data is bound to data. This can be useful when you need to inspect Panel#data objects. @since 2.2 @return {Panel} -
findTemplateBinder(
) → Panel? -
Available on GraphObject, provided by the GraphObject$Typings extension
(undocumented) This never-documented method has been renamed #findBindingPanel for v2.2 and will be removed in v3.0. @return {Panel} -
getDocumentAngle(
) → num -
Available on GraphObject, provided by the GraphObject$Typings extension
Returns the effective angle that the object is drawn at, in document coordinates, normalized to between 0 and 360. -
getDocumentBounds(
[Rect? result]) → Rect -
Available on GraphObject, provided by the GraphObject$Typings extension
Returns the Rect in document coordinates for this object's bounds. If this GraphObject is a Part, the rect will be identical to its #actualBounds. @param {Rect=} result an optional Rect that is modified and returned. @return {Rect} in document coordinates. @see #getDocumentPoint @since 2.0 -
getDocumentPoint(
Object local, [Point? result]) → Point -
Available on GraphObject, provided by the GraphObject$Typings extension
Returns the Point in document coordinates for a given Spot in this object's bounds or for a Point in local coordinates. -
getDocumentScale(
) → num -
Available on GraphObject, provided by the GraphObject$Typings extension
Returns the total scale that the object is drawn at, in document coordinates. -
getLocalPoint(
Point p, [Point? result]) → Point -
Available on GraphObject, provided by the GraphObject$Typings extension
Given a Point in document coordinates, returns a new Point in local coordinates. -
isContainedBy(
GraphObject panel) → bool -
Available on GraphObject, provided by the GraphObject$Typings extension
This predicate is true if this object is an element, perhaps indirectly, of the given panel. -
isEnabledObject(
) → bool -
Available on GraphObject, provided by the GraphObject$Typings extension
This predicate is false if this object is inside any Panel that is not Panel#isEnabled, or if this is itself a disabled panel. This ignores the #visible and #pickable properties. @return {boolean} @see #enabledChanged @see Panel#isEnabled @since 1.7 -
isVisibleObject(
) → bool -
Available on GraphObject, provided by the GraphObject$Typings extension
This predicate is true if this object is #visible and each of its visual containing panels is also visible. This ignores the actual location or appearance (except visibility) of the panel that this object is part of, as well as ignoring all properties of the Layer or Diagram. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
set(
dynamic config) → GraphObject -
Available on GraphObject, provided by the GraphObject$Typings extension
Set any number of properties on this GraphObject. This is common in initialization. This method can only be used to set existing properties on this object. To attach new properties, or to set properties of elements, use GraphObject#setProperties. -
setProperties(
Object props) → GraphObject -
Available on GraphObject, provided by the GraphObject$Typings extension
This method sets a collection of properties according to the property/value pairs on the given Object, in the same manner as GraphObject.make does when constructing a GraphObject with an argument that is a simple JavaScript Object. -
toString(
) → String -
A string representation of this object.
inherited
-
trigger(
AnimationTrigger trigger) → GraphObject -
Available on GraphObject, provided by the GraphObject$Typings extension
Adds an AnimationTrigger to this GraphObject. @since 2.2 @param {AnimationTrigger} trigger an AnimationTrigger @return {Panel}
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- default$ ↔ EnumValue
-
GraphObjects with this enumeration as the value of GraphObject#stretch
are stretched depending on the context they are used. For instance a 'Circle' figure might
be uniformly stretched whereas an 'Ellipse' figure might be non-uniformly stretched.
getter/setter pair
- fill ↔ EnumValue
-
GraphObjects with this enumeration as the value of GraphObject#stretch
are scaled in both directions so as to fit exactly in the given bounds;
there is no clipping but the aspect ratio may change, causing the object to appear stretched.
getter/setter pair
- flipBoth ↔ EnumValue
-
GraphObjects with this enumeration as the value of Picture#flip or TextBlock#flip
are drawn with both X and Y coordinates reversed.
getter/setter pair
- flipHorizontal ↔ EnumValue
-
GraphObjects with this enumeration as the value of Picture#flip or TextBlock#flip
are drawn mirror-image, with X coordinate points increasing towards the left.
getter/setter pair
- flipVertical ↔ EnumValue
-
GraphObjects with this enumeration as the value of Picture#flip or TextBlock#flip
are drawn upside-down, with Y coordinate points increasing upwards.
getter/setter pair
- horizontal ↔ dynamic
-
GraphObjects with this enumeration as the value of GraphObject#stretch
are scaled as much as possible in the x-axis. In another context, can be used as a value of PanelLayout, so type is "any".
getter/setter pair
-
make
→ ({T Function<
T extends Adornment>(Make cls, [Iterable? initializers]) $1, T Function<T extends Panel>(MakeOptions cls, [Iterable? initializers]) $2, T Function<T extends GraphObject>(String cls, [Iterable? initializers]) $3, dynamic Function<CT extends ConstructorType< $4})CT> >(CT cls, [Iterable? initializers]) -
Overload accessor: $1, $2, $3, $4
no setter
- none ↔ EnumValue
-
GraphObjects with this enumeration as the value of GraphObject#stretch
are not automatically scaled to fit in the given bounds;
there may be clipping in one or both directions if the available dimensions are too small.
getter/setter pair
- uniform ↔ EnumValue
-
Pictures with this enumeration as the value of Picture#imageStretch are drawn with equal
scale in both directions to fit the larger side of the image bounds;
Panels of type Viewbox with this as the value of Panel#viewboxStretch
scale the contained element equally in both directions to fit the larger side
of the element's bounds in the given bounds.
getter/setter pair
- uniformToFill ↔ EnumValue
-
Pictures with this enumeration as the value of Picture#imageStretch are drawn with equal
scale in both directions to fit the arranged (actual) bounds;
Panels of type Viewbox with this as the value of Panel#viewboxStretch
scale the contained element equally in both directions to fit the smaller side
of the element's bounds in the given bounds.
There may be clipping in one dimension.
getter/setter pair
- vertical ↔ dynamic
-
GraphObjects with this enumeration as the value of GraphObject#stretch
are scaled as much as possible in the y-axis. In another context, can be used as a value of PanelLayout, so type is "any".
getter/setter pair
Static Methods
-
build<
T extends GraphObject> (String name, [dynamic config, Iterable? args]) → T - This static function creates an instance that was defined with GraphObject.defineBuilder. Once this is called one can use the name as the first argument for GraphObject.make. Names are case sensitive.
-
defineBuilder(
String name, Object func(Array)) → void - This static function defines a named function that GraphObject.make or GraphObject.build can use to build objects. Once this is called one can use the name as the first argument for GraphObject.make or GraphObject.build. Names are case sensitive.
-
takeBuilderArgument(
Array args, [dynamic defval, bool pred([dynamic])?]) → dynamic - This static function returns the first argument from the arguments array passed to a GraphObject.defineBuilder function by GraphObject.make. By default this requires the first argument to be a string, but you can provide a predicate to determine whether the argument is suitable.