mxText

Extends mxShape to implement a text shape.  To change vertical text from bottom to top to top to bottom, the following code can be used:

mxText.prototype.verticalTextRotation = 90;
Summary
mxTextExtends mxShape to implement a text shape.
Functions
mxTextConstructs a new text shape.
Variables
baseSpacingTopSpecifies the spacing to be added to the top spacing.
baseSpacingBottomSpecifies the spacing to be added to the bottom spacing.
baseSpacingLeftSpecifies the spacing to be added to the left spacing.
baseSpacingRightSpecifies the spacing to be added to the right spacing.
replaceLinefeedsSpecifies if linefeeds in HTML labels should be replaced with BR tags.
verticalTextRotationRotation for vertical text.
ignoreClippedStringSizeSpecifies if the actual string size should be measured if a label is clipped.
ignoreStringSizeSpecifies if the actual string size should be measured.
Functions
isParseVmlText shapes do not contain VML markup and do not need to be parsed.
isHtmlAllowedReturns true if HTML is allowed for this shape.
getSvgScreenOffsetDisables offset in IE9 for crisper image output.
checkBoundsReturns true if the bounds are not null and all of its variables are numeric.
applyExtends mxShape to updat the text styles.
updateBoundingBoxUpdates the <boundingBox> for this shape using the given node and position.
getShapeRotationReturns 0 to avoid using rotation in the canvas via updateTransform.
getTextRotationReturns the rotation for the text label of the corresponding shape.
isPaintBoundsInvertedInverts the bounds if <mxShape.isBoundsInverted> returns true or if the horizontal style is false.
configureCanvasSets the state of the canvas for drawing the shape.
updateVmlContainerSets the width and height of the container to 1px.
paintGeneric rendering code.
redrawHtmlShapeUpdates the HTML node(s) to reflect the latest bounds and scale.
updateHtmlTransformReturns the spacing as an mxPoint.
updateHtmlFilterRotated text rendering quality is bad for IE9 quirks/IE8 standards
updateValueUpdates the HTML node(s) to reflect the latest bounds and scale.
updateFontUpdates the HTML node(s) to reflect the latest bounds and scale.
updateSizeUpdates the HTML node(s) to reflect the latest bounds and scale.
getMarginReturns the spacing as an mxPoint.
getSpacingReturns the spacing as an mxPoint.

Functions

mxText

function mxText(value,
bounds,
align,
valign,
color,
family,
size,
fontStyle,
spacing,
spacingTop,
spacingRight,
spacingBottom,
spacingLeft,
horizontal,
background,
border,
wrap,
clipped,
overflow,
labelPadding)

Constructs a new text shape.

Parameters

valueString that represents the text to be displayed.  This is stored in <value>.
boundsmxRectangle that defines the bounds.  This is stored in mxShape.bounds.
alignSpecifies the horizontal alignment.  Default is ‘’.  This is stored in <align>.
valignSpecifies the vertical alignment.  Default is ‘’.  This is stored in <valign>.
colorString that specifies the text color.  Default is ‘black’.  This is stored in <color>.
familyString that specifies the font family.  Default is mxConstants.DEFAULT_FONTFAMILY.  This is stored in <family>.
sizeInteger that specifies the font size.  Default is mxConstants.DEFAULT_FONTSIZE.  This is stored in <size>.
fontStyleSpecifies the font style.  Default is 0.  This is stored in <fontStyle>.
spacingInteger that specifies the global spacing.  Default is 2.  This is stored in <spacing>.
spacingTopInteger that specifies the top spacing.  Default is 0.  The sum of the spacing and this is stored in <spacingTop>.
spacingRightInteger that specifies the right spacing.  Default is 0.  The sum of the spacing and this is stored in <spacingRight>.
spacingBottomInteger that specifies the bottom spacing.  Default is 0.The sum of the spacing and this is stored in <spacingBottom>.
spacingLeftInteger that specifies the left spacing.  Default is 0.  The sum of the spacing and this is stored in <spacingLeft>.
horizontalBoolean that specifies if the label is horizontal.  Default is true.  This is stored in <horizontal>.
backgroundString that specifies the background color.  Default is null.  This is stored in <background>.
borderString that specifies the label border color.  Default is null.  This is stored in <border>.
wrapSpecifies if word-wrapping should be enabled.  Default is false.  This is stored in <wrap>.
clippedSpecifies if the label should be clipped.  Default is false.  This is stored in <clipped>.
overflowValue of the overflow style.  Default is ‘visible’.

Variables

baseSpacingTop

mxText.prototype.baseSpacingTop

Specifies the spacing to be added to the top spacing.  Default is 0.  Use the value 5 here to get the same label positions as in mxGraph 1.x.

baseSpacingBottom

mxText.prototype.baseSpacingBottom

Specifies the spacing to be added to the bottom spacing.  Default is 0.  Use the value 1 here to get the same label positions as in mxGraph 1.x.

baseSpacingLeft

mxText.prototype.baseSpacingLeft

Specifies the spacing to be added to the left spacing.  Default is 0.

baseSpacingRight

mxText.prototype.baseSpacingRight

Specifies the spacing to be added to the right spacing.  Default is 0.

replaceLinefeeds

mxText.prototype.replaceLinefeeds

Specifies if linefeeds in HTML labels should be replaced with BR tags.  Default is true.

verticalTextRotation

mxText.prototype.verticalTextRotation

Rotation for vertical text.  Default is -90 (bottom to top).

ignoreClippedStringSize

mxText.prototype.ignoreClippedStringSize

Specifies if the actual string size should be measured if a label is clipped.  If disabled the boundingBox will not ignore the actual size of the string, otherwise <bounds> will be used instead.  Default is true.  ignoreStringSize has precedence over this switch.

ignoreStringSize

mxText.prototype.ignoreStringSize

Specifies if the actual string size should be measured.  If disabled the boundingBox will not ignore the actual size of the string, otherwise <bounds> will be used instead.  Default is false.

Functions

isParseVml

mxText.prototype.isParseVml = function()

Text shapes do not contain VML markup and do not need to be parsed.  This method returns false to speed up rendering in IE8.

isHtmlAllowed

mxText.prototype.isHtmlAllowed = function()

Returns true if HTML is allowed for this shape.  This implementation returns true if the browser is not in IE8 standards mode.

getSvgScreenOffset

mxText.prototype.getSvgScreenOffset = function()

Disables offset in IE9 for crisper image output.

checkBounds

mxText.prototype.checkBounds = function()

Returns true if the bounds are not null and all of its variables are numeric.

apply

mxText.prototype.apply = function(state)

Extends mxShape to updat the text styles.

Parameters

statemxCellState of the corresponding cell.

updateBoundingBox

mxText.prototype.updateBoundingBox = function()

Updates the <boundingBox> for this shape using the given node and position.

getShapeRotation

mxText.prototype.getShapeRotation = function()

Returns 0 to avoid using rotation in the canvas via updateTransform.

getTextRotation

mxText.prototype.getTextRotation = function()

Returns the rotation for the text label of the corresponding shape.

isPaintBoundsInverted

mxText.prototype.isPaintBoundsInverted = function()

Inverts the bounds if <mxShape.isBoundsInverted> returns true or if the horizontal style is false.

configureCanvas

mxText.prototype.configureCanvas = function(c,
x,
y,
w,
h)

Sets the state of the canvas for drawing the shape.

updateVmlContainer

mxText.prototype.updateVmlContainer = function()

Sets the width and height of the container to 1px.

paint

mxText.prototype.paint = function(c)

Generic rendering code.

redrawHtmlShape

mxText.prototype.redrawHtmlShape = function()

Updates the HTML node(s) to reflect the latest bounds and scale.

updateHtmlTransform

mxText.prototype.updateHtmlTransform = function()

Returns the spacing as an mxPoint.

updateHtmlFilter

mxText.prototype.updateHtmlFilter = function()

Rotated text rendering quality is bad for IE9 quirks/IE8 standards

updateValue

mxText.prototype.updateValue = function()

Updates the HTML node(s) to reflect the latest bounds and scale.

updateFont

mxText.prototype.updateFont = function(node)

Updates the HTML node(s) to reflect the latest bounds and scale.

updateSize

mxText.prototype.updateSize = function(node)

Updates the HTML node(s) to reflect the latest bounds and scale.

getMargin

Returns the spacing as an mxPoint.

getSpacing

mxText.prototype.getSpacing = function()

Returns the spacing as an mxPoint.

Base class for all shapes.
function mxText(value,
bounds,
align,
valign,
color,
family,
size,
fontStyle,
spacing,
spacingTop,
spacingRight,
spacingBottom,
spacingLeft,
horizontal,
background,
border,
wrap,
clipped,
overflow,
labelPadding)
Constructs a new text shape.
mxText.prototype.baseSpacingTop
Specifies the spacing to be added to the top spacing.
mxText.prototype.baseSpacingBottom
Specifies the spacing to be added to the bottom spacing.
mxText.prototype.baseSpacingLeft
Specifies the spacing to be added to the left spacing.
mxText.prototype.baseSpacingRight
Specifies the spacing to be added to the right spacing.
mxText.prototype.replaceLinefeeds
Specifies if linefeeds in HTML labels should be replaced with BR tags.
mxText.prototype.verticalTextRotation
Rotation for vertical text.
mxText.prototype.ignoreClippedStringSize
Specifies if the actual string size should be measured if a label is clipped.
mxText.prototype.ignoreStringSize
Specifies if the actual string size should be measured.
mxText.prototype.isParseVml = function()
Text shapes do not contain VML markup and do not need to be parsed.
mxText.prototype.isHtmlAllowed = function()
Returns true if HTML is allowed for this shape.
mxText.prototype.getSvgScreenOffset = function()
Disables offset in IE9 for crisper image output.
mxText.prototype.checkBounds = function()
Returns true if the bounds are not null and all of its variables are numeric.
mxText.prototype.apply = function(state)
Extends mxShape to updat the text styles.
mxText.prototype.updateBoundingBox = function()
Updates the boundingBox for this shape using the given node and position.
mxText.prototype.getShapeRotation = function()
Returns 0 to avoid using rotation in the canvas via updateTransform.
mxText.prototype.getTextRotation = function()
Returns the rotation for the text label of the corresponding shape.
mxText.prototype.isPaintBoundsInverted = function()
Inverts the bounds if mxShape.isBoundsInverted returns true or if the horizontal style is false.
mxText.prototype.configureCanvas = function(c,
x,
y,
w,
h)
Sets the state of the canvas for drawing the shape.
mxText.prototype.updateVmlContainer = function()
Sets the width and height of the container to 1px.
mxText.prototype.paint = function(c)
Generic rendering code.
mxText.prototype.redrawHtmlShape = function()
Updates the HTML node(s) to reflect the latest bounds and scale.
mxText.prototype.updateHtmlTransform = function()
Returns the spacing as an mxPoint.
Implements a 2-dimensional vector with double precision coordinates.
mxText.prototype.updateHtmlFilter = function()
Rotated text rendering quality is bad for IE9 quirks/IE8 standards
mxText.prototype.updateValue = function()
Updates the HTML node(s) to reflect the latest bounds and scale.
mxText.prototype.updateFont = function(node)
Updates the HTML node(s) to reflect the latest bounds and scale.
mxText.prototype.updateSize = function(node)
Updates the HTML node(s) to reflect the latest bounds and scale.
mxText.prototype.getSpacing = function()
Returns the spacing as an mxPoint.
Extends mxPoint to implement a 2-dimensional rectangle with double precision coordinates.
mxShape.prototype.bounds
Holds the mxRectangle that specifies the bounds of this shape.
Defines the default family for all fonts in points.
Defines the default size for all fonts in points.
Represents the current state of a cell in a given mxGraphView.
Close