# JSXGraph Reference

## JavaScript must be enabled in order for you to use JSXGraph and JSXGraph reference. However, it seems JavaScript is either disabled or not supported by your browser.

Class Index | File Index

## Elements

## Classes

- _global_
- Angle
- Arc
- Arrow
- Arrowparallel
- Axis
- Bisector
- Bisectorlines
- Button
- Checkbox
- Circle
- Circumcenter
- Circumcircle
- CircumcircleArc
- CircumcircleSector
- Conic
- Curve
- Ellipse
- Functiongraph
- Glider
- Grid
- Group
- Hatch
- Hyperbola
- Image
- Incenter
- Incircle
- Inequality
- Input
- Integral
- Intersection
- JXG
- JXG.AbstractRenderer
- JXG.Board
- JXG.C
- JXG.CA
- JXG.CanvasRenderer
- JXG.Circle
- JXG.Complex
- JXG.Composition
- JXG.Coords
- JXG.CoordsElement
- JXG.Curve
- JXG.Dump
- JXG.EventEmitter
- JXG.GeometryElement
- JXG.GeonextParser
- JXG.Group
- JXG.Image
- JXG.JessieCode
- JXG.JSXGraph
- JXG.Line
- JXG.Math
- JXG.Math.Geometry
- JXG.Math.Numerics
- JXG.Math.Poly
- JXG.Math.Poly.Monomial
- JXG.Math.Poly.Polynomial
- JXG.Math.Poly.Ring
- JXG.Math.Statistics
- JXG.Math.Symbolic
- JXG.NoRenderer
- JXG.Options
- JXG.Point
- JXG.Polygon
- JXG.Server
- JXG.Server.modules
- JXG.SVGRenderer
- JXG.Text
- JXG.Ticks
- JXG.Transformation
- JXG.Turtle
- JXG.Util
- JXG.Util.Base64
- JXG.Util.Unzip
- JXG.Util.UTF8
- JXG.VMLRenderer
- JXG.XML
- Label
- Line
- Locus
- MajorArc
- MajorSector
- Midpoint
- MinorArc
- MinorSector
- Mirrorpoint
- NonReflexAngle
- Normal
- Orthogonalprojection
- OtherIntersection
- Parabola
- Parallel
- Parallelpoint
- Perpendicular
- PerpendicularPoint
- PerpendicularSegment
- Point
- PolarLine
- PolePoint
- Polygon
- Quadtree
- RadicalAxis
- Reflection
- ReflexAngle
- RegularPolygon
- Riemannsum
- Sector
- Segment
- Semicircle
- Slider
- Slopetriangle
- Spline
- Stepfunction
- Tangent
- Tapemeasure
- Text
- Ticks
- Tracecurve
- Transformation
- Turtle

# Class JXG.Text

JXG.GeometryElement,JXG.CoordsElement
↳ JXG.Text

Creates a new text object. Do not use this constructor to create a text. Use JXG.Board#create with type Text instead.
Defined in: text.js.
Extends JXG.CoordsElement, JXG.GeometryElement.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| JXG.Text(board, coordinates, attributes, content) Construct and handle texts.

Fields borrowed from class JXG.GeometryElement:
  _org_type, _pos, ancestors, baseElement, board, childElements, dash, descendants, draft, dump, elementClass, elType, fillColor, fillOpacity, fixed, frozen, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, inherits, isDraggable, isReal, lastDragTime, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, parents, quadraticform, rendNode, scalable, shadow, snapToGrid, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, trace, traceAttributes, traces, transformations, transitionDuration, type, visible, visProp, visPropCalc, withLabel
Fields borrowed from class JXG.CoordsElement:
  coords, groups, needsUpdateFromParent, onPolygon, position, slideObjects

Fields borrowed from class JXG.GeometryElement:
  _org_type, _pos, ancestors, baseElement, board, childElements, dash, descendants, draft, dump, elementClass, elType, fillColor, fillOpacity, fixed, frozen, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, inherits, isDraggable, isReal, lastDragTime, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, parents, quadraticform, rendNode, scalable, shadow, snapToGrid, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, trace, traceAttributes, traces, transformations, transitionDuration, type, visible, visProp, visPropCalc, withLabel
Fields borrowed from class JXG.CoordsElement:
  coords, groups, needsUpdateFromParent, onPolygon, position, slideObjects

Method Summary
Method Attributes | Method Name and Description
--- | ---
<private> | _setText(text) Defines new content.
<private> | _setUpdateText(text) This sets the updateText function of this element depending on the type of text content passed.
<private> | checkForSizeUpdate() Used to save updateSize() calls.
<private> | convertGeonext2CSS(s) Converts the GEONExT tags <overline> and <arrow> to HTML span tags with proper CSS formating.
| crudeSizeEstimate() A very crude estimation of the dimensions of the textbox in case nothing else is available.
<private> | expandShortMath(expr) Converts shortened math syntax into correct syntax: 3x instead of 3*x or (a+b)(3+1) instead of (a+b)*(3+1).
<private> | generateTerm(contentStr, expand) Converts the GEONExT syntax of the <value> terms into JavaScript.
| getSize() Return the width of the text element.
<private> | hasPoint(x, y)
<private> | notifyParents(content) Finds dependencies in a given term and notifies the parents by adding the dependent object to the found objects child elements.
| replaceSub(te) Replace _{} by <sub>
| replaceSup(te) Replace ^{} by <sup>
| setCoords(x, y) Move the text to new coordinates.
| setText(text) Defines new content.
| setTextJessieCode(text) Defines new content but converts < and > to HTML entities before updating the DOM.
| update(fromParent) Evaluates the text.
<private> | updateRenderer() The update function of the renderert is called.
| updateSize() Recompute the width and the height of the text box.
| updateText()
| utf8_decode(string) Decode unicode entities into characters.

Methods borrowed from class JXG.GeometryElement:
  _set, addChild, addDescendants, addParents, addRotation, addTransform, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, fullUpdate, generatePolynomial, getAttribute, getAttributes, getLabelAnchor, getName, getParents, getProperty, getTextAnchor, getType, handleSnapToGrid, hideElement, labelColor, noHighlight, normalize, prepareUpdate, remove, removeChild, removeDescendants, resolveShortcuts, setArrow, setAttribute, setDash, setDisplayRendNode, setLabel, setLabelText, setName, setParents, setPosition, setPositionDirectly, setProperty, showElement, snapToPoints, updateVisibility
Methods borrowed from class JXG.CoordsElement:
  _anim, addAnchor, addConstraint, Dist, free, handleAttractors, handleSnapToPoints, makeGlider, moveAlong, moveTo, popSlideObject, setGliderPosition, setPositionByTransform, updateConstraint, updateCoords, updateGlider, updateGliderFromParent, updateTransform, visit, X, XEval, Y, YEval, Z, ZEval

Events borrowed from class JXG.GeometryElement:
  attribute, attribute:<attribute><attribute>, down, drag, mousedown, mousedrag, mousemove, mouseout, mouseover, mouseup, move, out, over, touchdown, touchdrag, touchup, up

Class Detail
JXG.Text(board, coordinates, attributes, content)
Construct and handle texts. The coordinates can be relative to the coordinates of an element given in JXG.Options#text.anchor. MathJax, HTML and GEONExT syntax can be handled.

Parameters:
{string|JXG.Board} board
  The board the new text is drawn on.
{Array} coordinates
  An array with the user coordinates of the text.
{Object} attributes
  An object containing visual properties and optional a name and a id.
{string|function} content
  A string or a function returning a string.

Method Detail
<private> {JXG.Text} _setText(text)
Defines new content. This is used by JXG.Text#setTextJessieCode and JXG.Text#setText. This is required because JessieCode needs to filter all Texts inserted into the DOM and thus has to replace setText by setTextJessieCode.

Parameters:
{String|Function|Number} text

Returns:
  {JXG.Text}

<private> _setUpdateText(text)
This sets the updateText function of this element depending on the type of text content passed. Used by JXG.Text#_setText and JXG.Text constructor.

Parameters:
{String|Function|Number} text

<private> checkForSizeUpdate()
Used to save updateSize() calls. Called in JXG.Text.update That means this.update() has been called. More tests are in JXG.Renderer.updateTextStyle. The latter tests are one update off. But this should pose not too many problems, since it affects fontSize and cssClass changes.

<private> convertGeonext2CSS(s)
Converts the GEONExT tags <overline> and <arrow> to HTML span tags with proper CSS formating.

Parameters:
s

See:
  JXG.Text.generateTerm @see JXG.Text._setText

{Array} crudeSizeEstimate()
A very crude estimation of the dimensions of the textbox in case nothing else is available.

Returns:
  {Array}

<private> {string} expandShortMath(expr)
Converts shortened math syntax into correct syntax: 3x instead of 3*x or (a+b)(3+1) instead of (a+b)*(3+1).

Parameters:
expr

Returns:
  {string} expanded String

<private> generateTerm(contentStr, expand)
Converts the GEONExT syntax of the <value> terms into JavaScript. Also, all Objects whose name appears in the term are searched and the text is added as child to these objects.

Parameters:
contentStr
expand

See:
  JXG.GeonextParser.geonext2JS.

{Array} getSize()
Return the width of the text element.

Returns:
  {Array} [width, height] in pixel

<private> {Boolean} hasPoint(x, y)

Parameters:
{Number} x
{Number} y

Returns:
  {Boolean}

<private> notifyParents(content)
Finds dependencies in a given term and notifies the parents by adding the dependent object to the found objects child elements.

Parameters:
{String} content
  String containing dependencies for the given object.

{String} replaceSub(te)
Replace _{} by <sub>

Parameters:
{String} te
  String containing _{}.

Returns:
  {String} Given string with _{} replaced by <sub>.

{String} replaceSup(te)
Replace ^{} by <sup>

Parameters:
{String} te
  String containing ^{}.

Returns:
  {String} Given string with ^{} replaced by <sup>.

{object} setCoords(x, y)
Move the text to new coordinates.

Parameters:
{number} x
{number} y

Returns:
  {object} reference to the text object.

{JXG.Text} setText(text)
Defines new content.

Parameters:
{String|function} text

Returns:
  {JXG.Text} Reference to the text object.

setTextJessieCode(text)
Defines new content but converts < and > to HTML entities before updating the DOM.

Parameters:
{String|function} text

update(fromParent)
Evaluates the text. Then, the update function of the renderer is called.

Parameters:
fromParent

<private> updateRenderer()
The update function of the renderert is called.

updateSize()
Recompute the width and the height of the text box. Update array this.size with pixel values. The result may differ from browser to browser by some pixels. In canvas an old IEs we use a very crude estimation of the dimensions of the textbox. In JSXGraph this.size is necessary for applying rotations in IE and for aligning text.

updateText()

{String} utf8_decode(string)
Decode unicode entities into characters.

Parameters:
{String} string

Returns:
  {String}

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Aug 23 2017 17:12:47 GMT-0000 (UTC)