VS.ShapeConnector()

This class is a parent of a group of shapes that it arranges in several different tree and flow patterns and connects with lines. A ShapeConnector is always created as a child of an existing shape with the VS.Shape.AddShapeConnector() method.

var myShapeConnector=myShape.AddShapeConnector(ShapeConnectorType);

The ShapeConnectorType may be a flowchart (Flowchart), decision tree (Decisiontree), mind map (Mindmap), org chart (OrgChart), or the default hierarchy (Hierarchy).

VS.ShapeConnectorTypes =
{
Flowchart: "Flowchart",
DecisionTree: "Decisiontree",
Mindmap: "Mindmap",
OrgChart: "OrgChart",
Hierarchy: "Hierarchy",
};

VisualScript set shape connector type

VS.ShapeConnector() Methods

These methods returns a Shape object:

The following methods return the ShapeConnector and can be chained together (myShape.SetTextColor().SetTextFont().SetTextSize() etc):

  • Collapse() - Overrides the expand/collapse state of the ShapeConnector. By default, the state is expanded, so using this would set the shapes to be hidden behind a plus sign.
  • SetArrangement() - Overrides the arrangement of the shapes connected by a ShapeConnector. The arrangement can be in a row, staggered, or in columns.
  • SetDirection() - Sets the direction (right,left,up,down) of the ShapeConnector
  • SetEndArrow() - Overrides the arrow setting at the point where a line enters a shape
  • SetFillColor() - Overrides the background color of any text label on the ShapeConnector
  • SetLineColor() - Overrides the color of the ShapeConnector lines
  • SetLinePattern() - Overrides the pattern of the ShapeConnector lines
  • SetLineThickness() - Overrides the thickness of the ShapeConnector lines
  • SetStartArrow() - Overrides the arrow setting at the point that a line leaves a shape
  • SetTextBold() - Overrides the bold state of the text labels on the ShapeConnector
  • SetTextColor() - Overrides the color of text labels on the ShapeConnector
  • SetTextFont() - Overrides the font of text labels on the ShapeConnector
  • SetTextItalic() - Overrides the italic state of the text labels on ShapeConnector
  • SetTextSize() - Overrides the font size of text labels on the ShapeConnector
  • SetTextUnderline() - Overrides the underline state of the text labels on the ShapeConnector

AddDefaultShape()

Example

myDefaultShape=myShapeConnector.AddDefaultShape();

Syntax

myDefaultShape=myShapeConnector.AddDefaultShape();

Usage

This method adds a DefaultShape to a ShapeConnector. The DefaultShape returned is an instance of VS.Shape() and using its methods to set properties like ShapeType, FillColor and so on. These default settings apply to any shape added to the ShapeConnector. Individual shapes added with AddShape() can override these defaults.

AddShape()

Example

myShape=myShapeConnector.AddShape();

VisualScript add shape

Syntax

myShape=myShapeConnector.AddShape();

Usage

This method adds a VS.Shape() object to a ShapeConnector.

Collapse()

Example

myShapeConnector=myShapeConnector.Collapse();

VisualScript collapse

Syntax

myShapeConnector=myShapeConnector.Collapse();

Usage

This method is only used when building a SmartDraw Extension. It causes the initial state of the connector and its shapes to be hidden or collapsed. Clicking on the "+" icon in the resulting document opens up the connector again. Collapse() does not apply to Flowchart connectors.

SetArrangement()

Example

myShapeConnector=myShapeConnector.SetArrangement(VS.ConnectorArrangement.Stagger);

VisualScript set arrangement

Syntax

myShapeConnector=myShapeConnector.SetArrangement(arrangement);

Usage

This method only applies to two ShapeConnectors types: OrgChart and Hierarchy. It controls the layout and spacing of shapes for these types of connectors. Any of the values in VS.ConnectorArrangement() can be applied.

VS.ConnectorArrangement =
{
Row: "Row",
Stagger: "Stagger",
Column: "Column",
LeftColumn: "LeftColumn",
TwoColumn: "TwoColumn",
};

VisualScript arrangements

SetDirection()

Example

myShapeConnector=myShapeConnector.SetDirection(VS.Directions.Right);

VisualScript set direction

Syntax

myShapeConnector=myShapeConnector.SetDirection(direction);

Usage

This method sets the direction of a ShapeConnector. The behavior differs based on the ShapeConnectorType.

  • For OrgChart, Hierarchy and DecisionTree, only the first ShapeConnector in a hierarchy of nested ShapeConnectors responds to SetDirection and it sets the direction of the entire tree. These types of ShapeConnectors can only have one ShapeConnector per parent shape.
  • For MindMaps, the parent shape may have up to two ShapeConnectorsRight direction and one with a Left direction. SetDirecton() has no effect on nested ShapeConnectors.
  • For Flowcharts, a parent shape of a ShapeConnector may have multiple ShapeConnectors in any of the four directions. If a shape has two or more ShapeConnectors with the same direction, they form a split connector.

Here's an example of a Flowchart type ShapeConnector with two directions set to Right and one to Down.

var myC1= myShape.AddShapeConnector(VS.ShapeConnectorTypes.FlowChart).SetDirection(VS.Directions.Right);

myC1.AddShape();

var myC2= myShape.AddShapeConnector(VS.ShapeConnectorTypes.FlowChart).SetDirection(VS.Directions.Right);

myC2.AddShape()

var myC3= myShape.AddShapeConnector(VS.ShapeConnectorTypes.FlowChart).SetDirection(VS.Directions.Down);

myC3.AddShape()

Example

VisualScript directions

The default direction for a ShapeConnector also depends on its ShapeConnectorType:

    For OrgChart and Hierarchy, the default is Down

    For DecisionTree, MindMap and Flowchart, the default direction is Right

SetEndArrow()

Example

myShapeConnector=myShapeConnector.SetEndArrow(VS.Arrowheads.Filled);

VisualScript set end arrow

Syntax

myShapeConnector=myShapeConnector.SetEndArrow(arrowhead);

Usage

This method adds an arrowhead to the connector lines as they enter a shape. For a detailed list of arrowhead styles available, read the VSON markup reference guide. Options include: None, Filled, LineArrow, Fancy, FilledCircle, EmptyCircle, Diamond, etc.

SetFillColor()

Example

myShapeConnector=myShapeConnector.SetFillColor("#FF0000");

VisualScript set fill color

Syntax

myShapeConnector=myShapeConnector.SetFillColor(color);

Usage

This method overrides the default background color for text labels on the connector.

A color can be:

  • A string specifying an RGB literal in HTML format - "#FF00FF"
  • A string specifying an RGBA literal in HTML format - "#FF00FF80" - where the last byte is an opacity
  • A string specifying the name of a standard color defined by the VS.Document() SetColors() method

SetLineColor()

Example

myShapeConnector=myShapeConnector.SetLineColor(#FF0000");

VisualScript set line color

Syntax

myShapeConnector=myShapeConnector.SetLineColor(color);

Usage

This method sets the line color for a ShapeConnector.

A color can be:

  • A string specifying an RGB literal in HTML format - "#FF00FF"
  • A string specifying an RGBA literal in HTML format - "#FF00FF80" - where the last byte is an opacity
  • A string specifying the name of a standard color defined by the VS.Document() SetColors() method

SetLinePattern()

Example

myShapeConnector=myShapeConnector.SetLinePattern(VS.LinePatterns.Dotted);

VisualScript set line pattern

Syntax

myShapeConnector=myShapeConnector.SetLinePattern(linepattern);

Usage

This method overrides the default line pattern for a ShapeConnector. This can be dotted, dashed, or solid.

SetLineThickness()

Example

myShapeConnector=myShapeConnector.SetLineThickness(4);

VisualScript set line thickness

Syntax

myShapeConnector=myShapeConnector.SetLineThickness(thickness);

Usage

This method overrides the default line thickness a ShapeConnector.

SetStartArrow()

Example

myShapeConnector=myShapeConnector.SetStartArrow(VS.Arrowheads.Filled);

VisualScript set start arrow

Syntax

myShapeConnector=myShapeConnector.SetStartArrow(arrowhead);

Usage

This method adds an arrowhead to the connector lines as they leave a shape. For a detailed list of arrowhead styles available, read the VSON markup reference guide. Options include: None, Filled, LineArrow, Fancy, FilledCircle, EmptyCircle, Diamond, etc.

SetTextBold()

Example

myShapeConnector=myShapeConnector.SetTextBold(true);

VisualScript set text bold

Syntax

myShapeConnector=myShapeConnector.SetTextBold(bold);

Usage

This method sets the text labels on the connector to bold.

SetTextColor()

Example

myShapeConnector=myShapeConnector.SetTextColor("#FF0000");

VisualScript set text color

Syntax

myShapeConnector=myShapeConnector.SetTextColor(color);

Usage

This method overrides the default text color setting for text labels on the connector.

A color can be:

  • A string specifying an RGB literal in HTML format - "#FF00FF"
  • A string specifying an RGBA literal in HTML format - "#FF00FF80" - where the last byte is an opacity
  • A string specifying the name of a standard color defined by the VS.Document() SetColors() method

SetTextFont()

Example

myShapeConnector=myShapeConnector.SetTextFont("Copperplate");

VisualScript set text font

Syntax

myShapeConnector=myShapeConnector.SetTextFont(fontname);

Usage

This method overrides the default font for text labels on the connector.

SetTextItalic()

Example

myShapeConnector=myShapeConnector.SetTextItalic(true);

VisualScript set text italic

Syntax

myShapeConnector=myShapeConnector.SetTextItalic(italic);

Usage

This method overrides the default italic setting for text labels on the connector

SetTextSize()

Example

myShapeConnector=myShapeConnector.SetTextSize(18);

VisualScript set text size

Syntax

myShapeConnector=myShapeConnector.SetTextSize(textsize);

Usage

This method overrides the default text size setting for text labels on the connector in points.

SetTextUnderline()

Example

myShapeConnector=myShapeConnector.SetTextUnderline(true);

VisualScript set text underline

Syntax

myShapeConnector=myShapeConnector.SetTextUnderline(underline);

Usage

This method overrides the default underline setting for text labels on the connector.

By continuing to use the website, you consent to the use of cookies.   Read More