Class Text
JXG.CoordsElement,JXG.GeometryElement
↳ JXG.Text
↳ Text
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.
Defined in: text.js.
Extends
JXG.Text.
Constructor Attributes | Constructor Name and Description |
---|---|
Text(z_,x,y,str)
|
- 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, 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, type, visible, visProp, withLabel
- Fields borrowed from class JXG.CoordsElement:
- coords, groups, needsUpdateFromParent, onPolygon, position, slideObjects
Field Attributes | Field Name and Description |
---|---|
The horizontal alignment of the text.
|
|
The vertical alignment of the text.
|
|
List of attractor elements.
|
|
The precision of the slider value displayed in the optional text.
|
|
Used to round texts given by a number.
|
|
Determines the rendering method of the text.
|
|
Sensitive area for dragging the text.
|
|
The font size in pixels.
|
|
The precision of the slider value displayed in the optional text.
|
|
If enabled, the text will be handled as label.
|
|
If set to true, the text is parsed and evaluated.
|
|
Text rotation in degrees.
|
|
Defines together with Text#snapSizeY the grid the text snaps on to.
|
|
Defines together with Text#snapSizeX the grid the text snaps on to.
|
|
If true the input will be given to ASCIIMathML before rendering.
|
|
If set to true and caja's sanitizeHTML function can be found it
will be used to sanitize text output.
|
|
If true MathJax will be used to render the input string.
|
- 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, 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, type, visible, visProp, withLabel
- Fields borrowed from class JXG.CoordsElement:
- coords, groups, needsUpdateFromParent, onPolygon, position, slideObjects
- Methods borrowed from class JXG.Text:
- _setText, _setUpdateText, checkForSizeUpdate, convertGeonext2CSS, crudeSizeEstimate, expandShortMath, generateTerm, getSize, hasPoint, notifyParents, replaceSub, replaceSup, setCoords, setText, setTextJessieCode, update, updateRenderer, updateSize, updateText, utf8_decode
- Methods borrowed from class JXG.GeometryElement:
- _set, addChild, addDescendants, addParents, addRotation, addTransform, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, generatePolynomial, getAttribute, getAttributes, getLabelAnchor, getName, getParents, getProperty, getTextAnchor, getType, handleSnapToGrid, hideElement, labelColor, noHighlight, normalize, prepareUpdate, remove, removeChild, removeDescendants, resolveShortcuts, setArrow, setAttribute, setDash, setLabel, setLabelText, setName, setParents, setPosition, setPositionDirectly, setProperty, showElement, snapToPoints
- 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
- Parameters:
- {number|function_number|function_number|function_String|function} z_,x,y,str
- Parent elements for text elements.
Parent elements can be two or three elements of type number, a string containing a GEONExT constraint, or a function which takes no parameter and returns a number. Every parent element determines one coordinate. If a coordinate is given by a number, the number determines the initial position of a free text. If given by a string or a function that coordinate will be constrained that means the user won't be able to change the texts's position directly by mouse because it will be calculated automatically depending on the string or the function's return value. If two parent elements are given the coordinates will be interpreted as 2D affine Euclidean coordinates, if three such parent elements are given they will be interpreted as homogeneous coordinates.
The text to display may be given as string or as function returning a string. There is the attribute 'display' which takes the values 'html' or 'internal'. In case of 'html' a HTML division tag is created to display the text. In this case it is also possible to use ASCIIMathML. Incase of 'internal', a SVG or VML text element is used to display the text.
- See:
- JXG.Text
- Examples:
// Create a fixed text at position [0,1]. var t1 = board.create('text',[0,1,"Hello World"]);
// Create a variable text at a variable position. var s = board.create('slider',[[0,4],[3,4],[-2,0,2]]); var graph = board.create('text', [function(x){ return s.Value();}, 1, function(){return "The value of s is"+s.Value().toFixed(2);} ] );
// Create a text bound to the point A var p = board.create('point',[0, 1]), t = board.create('text',[0, -1,"Hello World"], {anchor: p});
Defined in: options.js.
- Default Value:
- null
Defined in: options.js.
- Default Value:
- 'left'
Defined in: options.js.
- Default Value:
- 'middle'
Defined in: options.js.
- Default Value:
- empty
Defined in: options.js.
Defined in: options.js.
- Default Value:
- 2
Defined in: options.js.
- Default Value:
- 'html'
Defined in: options.js.
- Default Value:
- 'all'
Defined in: options.js.
- Default Value:
- 12
Defined in: options.js.
Defined in: options.js.
- Default Value:
- false
Defined in: options.js.
- Default Value:
- true
Defined in: options.js.
- Default Value:
- 0
Defined in: options.js.
- See:
- JXG.Point#snapToGrid
- Text#snapSizeY
- JXG.Board#defaultAxes
- Default Value:
- 1
Defined in: options.js.
- See:
- JXG.Point#snapToGrid
- Text#snapSizeX
- JXG.Board#defaultAxes
- Default Value:
- 1
Defined in: options.js.
- Default Value:
- false
Defined in: options.js.
- Default Value:
- false
Defined in: options.js.
- Default Value:
- false