gojs
Version:
Interactive diagrams, charts, and graphs, such as trees, flowcharts, orgcharts, UML, BPMN, or business diagrams
809 lines (808 loc) • 66.6 kB
HTML
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>TextBlock | GoJS API</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../assets/css/bootstrap.min.css">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<!-- non-fixed navbar -->
<nav id="non-fixed-nav" class="navbar navbar-inverse navbar-top">
<div class="container-fluid">
<div class="navbar-header">
<div class="navheader-container">
<div class="navheader-collapse" data-toggle="collapse" data-target="#navbar">
<a id="toplogo" class="navbar-brand" href="../../index.html">GoJS</a>
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
</div>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="../../index.html">Home</a></li>
<li><a href="../../learn/index.html">Learn</a></li>
<li><a href="../../samples/index.html">Samples</a></li>
<li><a href="../../intro/index.html">Intro</a></li>
<li><a href="../../api/index.html" target="api">API</a></li>
<li><a href="https://www.nwoods.com/components/evalform.htm">Register</a></li>
<li><a href="../../download.html">Download</a></li>
<li><a href="https://forum.nwoods.com/c/gojs">Forum</a></li>
<li><a href="https://www.nwoods.com/contact.html" onclick="ga('send','event','Outbound Link','click','contact');">Contact</a></li>
<li class="buy"><a href="https://www.nwoods.com/sales/index.html" onclick="ga('send','event','Outbound Link','click','buy');">Buy</a></li>
<li class="activate"><a href="https://www.nwoods.com/app/activate.aspx?sku=gojs">Activate</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="tsd-page-header">
<div class="tsd-page-toolbar">
<div class="container-fluid plr15">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">GoJS API</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container-fluid plr15">
<div class="top-copyright">
<!--<b>GoJS</b>® Diagramming Components<br/>version <br/>version 2.1.18 for TypeScript/HTML<br/>by <a href="https://www.nwoods.com/">Northwoods Software®</a>-->
<b>GoJS</b>® Diagramming Components<br/>version 2.1.18<br/>by <a href="https://www.nwoods.com/">Northwoods Software®</a>
</div>
<div>
<h1>Class TextBlock</h1>
</div>
</div>
</div>
</div>
</header>
<div class="container-fluid container-main plr15">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-hierarchy">
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<a href="GraphObject.html" class="tsd-signature-type">GraphObject</a>
<ul class="tsd-hierarchy">
<li>
<span class="target">TextBlock</span>
</li>
</ul>
</li>
</ul>
</section>
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
<p>A TextBlock is a <a href="GraphObject.html">GraphObject</a> that displays a <a href="TextBlock.html#text">text</a> string in a given <a href="TextBlock.html#font">font</a>.</p>
<p>The size and appearance of the text is specified by <a href="TextBlock.html#font">font</a>,
which takes a well-formed CSS string as its value.
The order of the CSS properties given is important for cross-browser compatibility,
and should be given in this order:</p>
<p><em>"font-style font-variant font-weight font-size font-family"</em></p>
<p>For example, "Italic small-caps bold 32px Georgia, Serif" is a valid font string
using every CSS font property. Note that not all browsers may support every property.</p>
<p>Text is drawn using the <a href="TextBlock.html#stroke">stroke</a> brush, which may be any CSS color string or a <a href="Brush.html">Brush</a>.</p>
<p>Some created TextBlocks:</p>
<pre><code class="hljs js"><span class="hljs-keyword">var</span> $ = go.GraphObject.make; <span class="hljs-comment">// for conciseness in defining GraphObjects</span>
<span class="hljs-comment">// A TextBlock with text and stroke properties set:</span>
$(go.TextBlock, { <span class="hljs-attr">text</span>: <span class="hljs-string">"Hello World"</span>, <span class="hljs-attr">stroke</span>: <span class="hljs-string">"gray"</span> })
<span class="hljs-comment">// Alternatively:</span>
$(go.TextBlock, <span class="hljs-string">"Hello World"</span>, { <span class="hljs-attr">stroke</span>: <span class="hljs-string">"gray"</span> })</code></pre>
<p>TextBlocks typically receive a natural size based on their text and font strings,
but often a width is given in order to cause the text to wrap at a certain place.
In order for wrapping to occur, the <a href="TextBlock.html#wrap">wrap</a> property must not be <a href="TextBlock.html#static-None">TextBlock.None</a>.</p>
<p>TextBlocks can be edited by users using the <a href="TextEditingTool.html">TextEditingTool</a>.
The <a href="HTMLInfo.html">HTMLInfo</a> that a given TextBlock uses as its text editor can be customized
by setting the <a href="TextBlock.html#textEditor">textEditor</a> property. For an example of custom text editing tool use,
see the <a href="../../samples/customTextEditingTool.html">Custom TextEditingTool Sample</a>.</p>
<p class="boxread">
For examples of TextBlock possibilities and functionality,
see the <a href="../../intro/textBlocks.html">Introduction page on TextBlocks</a>.
</div>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section ">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="TextBlock.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#choices" class="tsd-kind-icon">choices</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#editable" class="tsd-kind-icon">editable</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#errorFunction" class="tsd-kind-icon">error<wbr>Function</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#flip" class="tsd-kind-icon">flip</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#font" class="tsd-kind-icon">font</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#graduatedEnd" class="tsd-kind-icon">graduated<wbr>End</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#graduatedFunction" class="tsd-kind-icon">graduated<wbr>Function</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#graduatedSkip" class="tsd-kind-icon">graduated<wbr>Skip</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#graduatedStart" class="tsd-kind-icon">graduated<wbr>Start</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#interval" class="tsd-kind-icon">interval</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#isMultiline" class="tsd-kind-icon">is<wbr>Multiline</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#isStrikethrough" class="tsd-kind-icon">is<wbr>Strikethrough</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#isUnderline" class="tsd-kind-icon">is<wbr>Underline</a></li>
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="TextBlock.html#lineCount" class="tsd-kind-icon">line<wbr>Count</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#maxLines" class="tsd-kind-icon">max<wbr>Lines</a></li>
<li class="tsd-kind-get-signature tsd-parent-kind-class"><a href="TextBlock.html#naturalBounds" class="tsd-kind-icon">natural<wbr>Bounds</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#overflow" class="tsd-kind-icon">overflow</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#stroke" class="tsd-kind-icon">stroke</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#text" class="tsd-kind-icon">text</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#textAlign" class="tsd-kind-icon">text<wbr>Align</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#textEdited" class="tsd-kind-icon">text<wbr>Edited</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#textEditor" class="tsd-kind-icon">text<wbr>Editor</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#textValidation" class="tsd-kind-icon">text<wbr>Validation</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#verticalAlignment" class="tsd-kind-icon">vertical<wbr>Alignment</a></li>
<li class="tsd-kind-accessor tsd-parent-kind-class"><a href="TextBlock.html#wrap" class="tsd-kind-icon">wrap</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="TextBlock.html#static-getBaseline" class="tsd-kind-icon">get<wbr>Baseline</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="TextBlock.html#static-getUnderline" class="tsd-kind-icon">get<wbr>Underline</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="TextBlock.html#static-setBaseline" class="tsd-kind-icon">set<wbr>Baseline</a></li>
<li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><a href="TextBlock.html#static-setUnderline" class="tsd-kind-icon">set<wbr>Underline</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Constants</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constant tsd-parent-kind-class tsd-is-static"><a href="TextBlock.html#static-None" class="tsd-kind-icon">None</a></li>
<li class="tsd-kind-constant tsd-parent-kind-class tsd-is-static"><a href="TextBlock.html#static-OverflowClip" class="tsd-kind-icon">Overflow<wbr>Clip</a></li>
<li class="tsd-kind-constant tsd-parent-kind-class tsd-is-static"><a href="TextBlock.html#static-OverflowEllipsis" class="tsd-kind-icon">Overflow<wbr>Ellipsis</a></li>
<li class="tsd-kind-constant tsd-parent-kind-class tsd-is-static"><a href="TextBlock.html#static-WrapBreakAll" class="tsd-kind-icon">Wrap<wbr>Break<wbr>All</a></li>
<li class="tsd-kind-constant tsd-parent-kind-class tsd-is-static"><a href="TextBlock.html#static-WrapDesiredSize" class="tsd-kind-icon">Wrap<wbr>Desired<wbr>Size</a></li>
<li class="tsd-kind-constant tsd-parent-kind-class tsd-is-static"><a href="TextBlock.html#static-WrapFit" class="tsd-kind-icon">Wrap<wbr>Fit</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Constructors</h2>
<section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class">
<a name="constructor" class="tsd-anchor"></a>
<h3>
constructor
</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">new <wbr>Text<wbr>Block<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="TextBlock.html" class="tsd-signature-type">TextBlock</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>A newly constructed <a href="TextBlock.html">TextBlock</a> has no string to show; if it did,
it would draw the text, wrapping if needed, in the default font using a black stroke.</p>
</div>
<h4 class="tsd-returns-title">Returns <a href="TextBlock.html" class="tsd-signature-type">TextBlock</a></h4>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Properties</h2>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="choices" class="tsd-anchor"></a>
<h3>
choices
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Array</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the an array of possible choices for a custom <a href="TextEditingTool.html">TextEditingTool</a>.
The value must be an array of strings.</p>
<p>The default value is null.
For example usage, see the <a href="../../samples/customTextEditingTool.html">Custom TextEditingTool Sample</a>.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.7</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="editable" class="tsd-anchor"></a>
<h3>
editable
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets whether or not this TextBlock allows in-place editing of the <a href="TextBlock.html#text">text</a>
string by the user with the help of the <a href="TextEditingTool.html">TextEditingTool</a>.
The default is false.</p>
<p>See also <a href="Part.html#textEditable">Part.textEditable</a>.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="errorFunction" class="tsd-anchor"></a>
<h3>
error<wbr>Function
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">tool</span><span class="tsd-signature-symbol">: </span><a href="TextEditingTool.html" class="tsd-signature-type">TextEditingTool</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">oldString</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">newString</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the function to call if a text edit made with the <a href="TextEditingTool.html">TextEditingTool</a> is invalid.
The default is null.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="flip" class="tsd-anchor"></a>
<h3>
flip
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EnumValue</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets how the TextBlock is displayed: Either normally or with a Horizontal or Vertical flip or both.</p>
<p>Possible values are <a href="GraphObject.html#static-None">GraphObject.None</a>, <a href="GraphObject.html#static-FlipHorizontal">GraphObject.FlipHorizontal</a>, <a href="GraphObject.html#static-FlipVertical">GraphObject.FlipVertical</a>, or <a href="GraphObject.html#static-FlipBoth">GraphObject.FlipBoth</a>.
The default is <a href="GraphObject.html#static-None">GraphObject.None</a>.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>2.0</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="font" class="tsd-anchor"></a>
<h3>
font
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the current font settings.
The font property must be a valid CSS string describing a font.
The font string can accept several CSS properties but they must be
in a specific order in order to render correctly across all browsers:</p>
<p><code>"font-style font-variant font-weight font-size font-family"</code></p>
<p>For example, <code>"Italic small-caps bold 32px Georgia, Serif"</code> is a valid font string
using every CSS font property. Not every browser can render every font option.
For more information about CSS font syntax, see <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/font">CSS fonts (mozilla.org)</a>.</p>
<p>If your Node sizes depend on TextBlocks, it is best to ensure any custom fonts you are using are finished loading before you load your Diagram.
This will ensure nodes are sized appropriately for the initial Diagram layout.</p>
<p>The default font is "13px sans-serif".</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="graduatedEnd" class="tsd-anchor"></a>
<h3>
graduated<wbr>End
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the fractional distance along the main shape of a "Graduated" <a href="Panel.html">Panel</a> at which this kind of tick text should end.
The default is 1; the value should range from 0 to 1.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.7</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="graduatedFunction" class="tsd-anchor"></a>
<h3>
graduated<wbr>Function
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">val</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the function to convert from a value along a "Graduated" <a href="Panel.html">Panel</a> to a string.
The default returns a string representing the value rounded to at most 2 decimals.</p>
<p>The function takes a number argument, a value between <a href="Panel.html#graduatedMin">Panel.graduatedMin</a> and <a href="Panel.html#graduatedMax">Panel.graduatedMax</a>.
The function will return a string, the text that will appear at the value of the argument.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.7</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="graduatedSkip" class="tsd-anchor"></a>
<h3>
graduated<wbr>Skip
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">val</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the function to determine which values along a "Graduated" <a href="Panel.html">Panel</a> will be skipped.
The default is null and doesn't skip any text labels.</p>
<p>The function takes a number argument, a value between <a href="Panel.html#graduatedMin">Panel.graduatedMin</a> and <a href="Panel.html#graduatedMax">Panel.graduatedMax</a>.
The function will return a boolean, whether the text label will be skipped at the value of the argument.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>2.0</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="graduatedStart" class="tsd-anchor"></a>
<h3>
graduated<wbr>Start
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the fractional distance along the main shape of a "Graduated" <a href="Panel.html">Panel</a> at which this text should start.
The default is 0; the value should range from 0 to 1.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.7</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="interval" class="tsd-anchor"></a>
<h3>
interval
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets how frequently this text should be drawn within a "Graduated" <a href="Panel.html">Panel</a>,
in multiples of the <a href="Panel.html#graduatedTickUnit">Panel.graduatedTickUnit</a>.
The default is 1. Any new value must be a positive integer.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.7</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="isMultiline" class="tsd-anchor"></a>
<h3>
is<wbr>Multiline
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets whether or not the text displays multiple lines or embedded newlines.
If this is false, all characters including and after the first newline will be omitted.
The default is true.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="TextBlock.html#maxLines">maxLines</a></p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="isStrikethrough" class="tsd-anchor"></a>
<h3>
is<wbr>Strikethrough
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets whether or not the text has a strikethrough line (line-through).
The default is false.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="TextBlock.html#isUnderline">isUnderline</a></p>
</dd>
<dt>since</dt>
<dd><p>1.2</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="isUnderline" class="tsd-anchor"></a>
<h3>
is<wbr>Underline
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets whether or not the text is underlined.
The default is false.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="TextBlock.html#isStrikethrough">isStrikethrough</a></p>
</dd>
<dt>since</dt>
<dd><p>1.2</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a name="lineCount" class="tsd-anchor"></a>
<h3>
<span class="tsd-flag ts-flagReadOnly">Read-only</span>
line<wbr>Count
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>This read-only property returns the total number of lines in this TextBlock, including lines created
from embedded newlines (<code>\n</code>), <a href="TextBlock.html#wrap">wrap</a>ping, and <a href="TextBlock.html#maxLines">maxLines</a>.</p>
<p>This value may be meaningless before the TextBlock is measured.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="maxLines" class="tsd-anchor"></a>
<h3>
max<wbr>Lines
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the maximum number of lines that this TextBlock can display.
Value must be a greater than zero whole number or <code>Infinity</code>.
The default is <code>Infinity</code>.</p>
<p>Modifying this value may modify the computed height of the TextBlock.
If maxLines is set, the value of <a href="TextBlock.html#lineCount">lineCount</a> will never be larger than maxLines.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="TextBlock.html#isMultiline">isMultiline</a></p>
</dd>
<dt>since</dt>
<dd><p>1.5</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-get-signature tsd-parent-kind-class">
<a name="naturalBounds" class="tsd-anchor"></a>
<h3>
<span class="tsd-flag ts-flagOverride">Override</span>
<span class="tsd-flag ts-flagReadOnly">Read-only</span>
natural<wbr>Bounds
<span class="tsd-signature-symbol">: </span><a href="Rect.html" class="tsd-signature-type">Rect</a> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>This read-only property returns the natural bounds of this TextBlock in local coordinates,
as determined by its <a href="TextBlock.html#font">font</a> and <a href="TextBlock.html#text">text</a> string, and optionally its <a href="GraphObject.html#desiredSize">desiredSize</a>.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="overflow" class="tsd-anchor"></a>
<h3>
overflow
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EnumValue</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets how text that is too long to display should be handled.</p>
<p>Possible values are <a href="TextBlock.html#static-OverflowClip">TextBlock.OverflowClip</a> and <a href="TextBlock.html#static-OverflowEllipsis">TextBlock.OverflowEllipsis</a>.
For OverflowEllipsis to work, you must constrain the available size of the TextBlock in some way,
such as setting <a href="TextBlock.html#wrap">wrap</a> to <a href="TextBlock.html#static-None">TextBlock.None</a>,
or limiting the number of lines with <a href="TextBlock.html#maxLines">maxLines</a> or a height constraint.</p>
<p>The default value is <a href="TextBlock.html#static-OverflowClip">TextBlock.OverflowClip</a>.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="TextBlock.html#wrap">wrap</a></p>
</dd>
<dt>since</dt>
<dd><p>1.4</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="stroke" class="tsd-anchor"></a>
<h3>
stroke
<span class="tsd-signature-symbol">: </span><a href="../index.html#BrushLike" class="tsd-signature-type">BrushLike</a> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the <a href="Brush.html">Brush</a> or string that describes the stroke (color) of the text that is drawn.</p>
<p>The default value is <code>"black"</code>.
Any valid CSS string can specify a solid color, and the <a href="Brush.html">Brush</a>
class can be used to specify a gradient or pattern.
More information about the syntax of CSS color strings is available at:
<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color">CSS colors (mozilla.org)</a>.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="text" class="tsd-anchor"></a>
<h3>
text
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the TextBlock's text string. The default is an empty string.
The text of a TextBlock, along with the values of <a href="TextBlock.html#font">font</a>, <a href="TextBlock.html#wrap">wrap</a>,
<a href="TextBlock.html#isMultiline">isMultiline</a> and sizing restrictions are what naturally determine
the size of the TextBlock.</p>
<p>The text in textblocks can include manual line-breaks by using the character escape, <code>\n</code>.</p>
<p>Leading and trailing whitespace is eliminated in each line of TextBlock text.</p>
<p>If <a href="TextBlock.html#editable">editable</a> is set to true, users can edit textblocks with the <a href="TextEditingTool.html">TextEditingTool</a>.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="textAlign" class="tsd-anchor"></a>
<h3>
text<wbr>Align
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">"left"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"right"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"start"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"end"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"center"</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the alignment location in the TextBlock's given space.
The only possible values are <code>"start"</code>, <code>"end"</code>, <code>"left"</code>, <code>"right"</code>, and <code>"center"</code>.
Any other value is invalid.</p>
<p>This property is most pertinent when the TextBlock has multiple lines of text,
or when the TextBlock is given a size that differs from the text's natural size (such as with <a href="GraphObject.html#desiredSize">desiredSize</a>).</p>
<p>In left-to-right writing systems, <code>"start"</code> and <code>"left"</code> are synonymous, as are <code>"end"</code> and <code>"right"</code>.</p>
<p>The default is <code>"start"</code>.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="TextBlock.html#verticalAlignment">verticalAlignment</a></p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="textEdited" class="tsd-anchor"></a>
<h3>
text<wbr>Edited
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">thisTextBlock</span><span class="tsd-signature-symbol">: </span><a href="TextBlock.html" class="tsd-signature-type">TextBlock</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">oldString</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">newString</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the function that is called after the TextBlock's text has been edited by the <a href="TextEditingTool.html">TextEditingTool</a>.</p>
<ul>
<li>The first argument is a reference to this TextBlock.</li>
<li>The second argument is the previous text, before editing.</li>
<li>The third argument is the current text, which is also TextBlock.text.</li>
</ul>
<pre><code class="hljs js"><span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">textBlock, previousText, currentText</span>)</span></code></pre>
<p>The default value is null -- no function is called.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>1.7</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="textEditor" class="tsd-anchor"></a>
<h3>
text<wbr>Editor
<span class="tsd-signature-symbol">: </span><a href="HTMLInfo.html" class="tsd-signature-type">HTMLInfo</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the HTMLInfo that this TextBlock uses as its text editor in the TextEditingTool.
If null, the TextBlock will use the default text editor of the <a href="TextEditingTool.html">TextEditingTool</a>.
The default is null.
The value should be set to an instance of <a href="HTMLInfo.html">HTMLInfo</a>.</p>
<p>As of 2.0 setting this to an HTML Element is no longer supported.</p>
<p>For example usage, see the <a href="../../samples/customTextEditingTool.html">Custom TextEditingTool Sample</a>.</p>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="textValidation" class="tsd-anchor"></a>
<h3>
text<wbr>Validation
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">thisTextBlock</span><span class="tsd-signature-symbol">: </span><a href="TextBlock.html" class="tsd-signature-type">TextBlock</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">oldString</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">newString</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the predicate that determines whether or not a user-edited string of text is valid.
If this is non-null, the predicate is called in addition to any <a href="TextEditingTool.html#textValidation">TextEditingTool.textValidation</a> predicate.
See <a href="TextEditingTool.html#isValidText">TextEditingTool.isValidText</a> for more details.</p>
<pre><code class="hljs js"><span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">textBlock, oldString, newString</span>)</span></code></pre>
<p>The default predicate is null, which is equivalent to simply returning true.</p>
<p>The function, if supplied, must not have any side-effects, and must return true or false.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="TextEditingTool.html#textValidation">TextEditingTool.textValidation</a></p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="verticalAlignment" class="tsd-anchor"></a>
<h3>
vertical<wbr>Alignment
<span class="tsd-signature-symbol">: </span><a href="Spot.html" class="tsd-signature-type">Spot</a> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets the vertical alignment <a href="Spot.html">Spot</a> of this TextBlock, used when
the TextBlock has more available vertical space than it needs to draw all lines.</p>
<p>The default value is <a href="Spot.html#static-Top">Spot.Top</a>, which aligns the TextBlock to the top of its available space.</p>
<p>The <a href="TextBlock.html#textAlign">textAlign</a> is often used along with this property to specify
where the should be positioned in its available space.</p>
<p>This does not affect TextBlock coordinates or bounds, it only affects where text is drawn within the given area.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="TextBlock.html#textAlign">textAlign</a></p>
</dd>
<dt>since</dt>
<dd><p>1.7</p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-accessor tsd-parent-kind-class">
<a name="wrap" class="tsd-anchor"></a>
<h3>
wrap
<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EnumValue</span> </h3>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets or sets whether the text should be wrapped if it is too long to fit on one line.</p>
<p>Possible values are <a href="TextBlock.html#static-WrapDesiredSize">TextBlock.WrapDesiredSize</a>, <a href="TextBlock.html#static-WrapFit">TextBlock.WrapFit</a>, <a href="TextBlock.html#static-WrapBreakAll">TextBlock.WrapBreakAll</a>,
and <a href="TextBlock.html#static-None">TextBlock.None</a>.</p>
<p>The default value is <a href="TextBlock.html#static-WrapDesiredSize">TextBlock.WrapDesiredSize</a>.</p>
<dl class="tsd-comment-tags">
<dt>see</dt>
<dd><p><a href="TextBlock.html#overflow">overflow</a></p>
</dd>
</dl>
</div>
</li>
</ul>
</section>
</section>
<section class="tsd-panel-group tsd-member-group ">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
<a name="static-getBaseline" class="tsd-anchor"></a>
<h3>
<span class="tsd-flag ts-flagStatic">Static</span>
get<wbr>Baseline
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
<li class="tsd-signature tsd-kind-icon">get<wbr>Baseline<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">textBlock</span><span class="tsd-signature-symbol">: </span><a href="TextBlock.html" class="tsd-signature-type">TextBlock</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">textHeight</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets the function that, given the TextBlock and numerical text height, computes the position to draw the baseline of a line of text in all TextBlocks.
By default this is null and default behavior returns <code>(textHeight * 0.75)</code>.</p>
<p>Note: This affects drawing only, and does not change TextBlock measurement calculations.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>2.0</p>
</dd>
</dl>
</div>
<h4 class="tsd-returns-title">Returns
<span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">textBlock</span><span class="tsd-signature-symbol">: </span><a href="TextBlock.html" class="tsd-signature-type">TextBlock</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">textHeight</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>
<span class="tsd-signature-symbol"> | </span>
<span class="tsd-signature-type">null</span>
</h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
<a name="static-getUnderline" class="tsd-anchor"></a>
<h3>
<span class="tsd-flag ts-flagStatic">Static</span>
get<wbr>Underline
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
<li class="tsd-signature tsd-kind-icon">get<wbr>Underline<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">textBlock</span><span class="tsd-signature-symbol">: </span><a href="TextBlock.html" class="tsd-signature-type">TextBlock</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">textHeight</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">null</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<div class="tsd-comment tsd-typography">
<p>Gets the function that, given the TextBlock and numerical text height, computes the position to draw the underline of a line of text in all TextBlocks.
By default this is null and default behavior returns <code>(textHeight * 0.75)</code>.</p>
<p>Note: This affects drawing only, and does not change TextBlock measurement calculations.</p>
<dl class="tsd-comment-tags">
<dt>since</dt>
<dd><p>2.0</p>
</dd>
</dl>
</div>
<h4 class="tsd-returns-title">Returns
<span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">textBlock</span><span class="tsd-signature-symbol">: </span><a href="TextBlock.html" class="tsd-signature-type">TextBlock</a><span class="tsd-signature-symbol">, </span><span class="tsd-signature-symbol">textHeight</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>
<span class="tsd-signature-symbol"> | </span>
<span class="tsd-signature-type">null</span>
</h4>
</li>
</ul>
</section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class tsd-is-static">
<a name="static-setBaseline" class="tsd-anchor"></a>
<h3>
<span class="tsd-flag ts-flagStatic">Static</span>
set<wbr>Baseline
</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
<li class="tsd-signature tsd-kind-icon">set<wbr>Baseline<span class="tsd-signature-symbol">(</span>value<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signatur