# 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
- Cardinalspline
- Checkbox
- Circle
- Circumcenter
- Circumcircle
- CircumcircleArc
- CircumcircleSector
- Conic
- Curve
- Derivative
- 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
- Mirrorelement
- 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 Ticks

JXG.GeometryElement
↳ JXG.Ticks
↳ Ticks

Ticks are used as distance markers on a line.
Defined in: ticks.js.
Extends JXG.Ticks.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| Ticks(line, distance)

Fields borrowed from class JXG.Ticks:
  board, equidistant, fixedTicks, labelCounter, labelData, line, minTicksDistance, ticks, ticksDelta, ticksFunction
Fields borrowed from class JXG.GeometryElement:
  _org_type, _pos, ancestors, baseElement, 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

Field Summary
Field Attributes | Field Name and Description
--- | ---
| anchor Determine the position of the tick with value 0.
| drawLabels Draw labels yes/no
| drawZero Draw the zero tick, that lies at line.point1?
| generateLabelText A function that expects two JXG.Coords, the first one representing the coordinates of the tick that is to be labeled, the second one the coordinates of the center (the tick with position 0).
<deprecated> | generateLabelValue A function that expects two JXG.Coords, the first one representing the coordinates of the tick that is to be labeled, the second one the coordinates of the center (the tick with position 0).
| includeBoundaries Whether line boundaries should be counted or not in the lower and upper bounds when creating ticks.
| insertTicks If the distance between two ticks is too big we could insert new ticks.
| labels User defined labels for special ticks.
| majorHeight Total height of a major tick.
| maxLabelLength The maximum number of characters a tick label can use.
| minorHeight Total height of a minor tick.
| minorTicks The number of minor ticks between two major ticks.
| precision If a label exceeds JXG.Ticks#maxLabelLength this determines the precision used to shorten the tick label.
| scale Scale the ticks but not the tick labels.
| scaleSymbol A string that is appended to every tick, used to represent the scale factor given in JXG.Ticks#scaleSymbol.
| tickEndings Decides in which direction finite ticks are visible.
| ticksDistance The default distance between two ticks.
| useUnicodeMinus Use the unicode character 0x2212, i.e.

Fields borrowed from class JXG.Ticks:
  board, equidistant, fixedTicks, labelCounter, labelData, line, minTicksDistance, ticks, ticksDelta, ticksFunction
Fields borrowed from class JXG.GeometryElement:
  _org_type, _pos, ancestors, baseElement, 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

Methods borrowed from class JXG.Ticks:
  _isInsideCanvas, adjustTickDistance, calculateTicksCoordinates, formatLabelText, generateEquidistantTicks, generateFixedTicks, generateLabelData, getDistanceFromZero, getLowerAndUpperBounds, getXandYdeltas, getZeroCoordinates, hasPoint, makeTicksFunction, processTickPosition, setPositionDirectly, setTicksSizeVariables, update, updateRenderer, updateRendererLabels
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, setProperty, showElement, snapToPoints, updateVisibility

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
Ticks(line, distance)

Parameters:
{JXG.Line} line
  The parents consist of the line the ticks are going to be attached to.
{Number} distance
  Number defining the distance between two major ticks or an array defining static ticks. Alternatively, the distance can be specified with the attribute "ticksDistance". For arbitrary lines (and not axes) a "zero coordinate" is determined which defines where the first tick is positioned. This zero coordinate can be altered with the attribute "anchor". Possible values are "left", "middle", "right" or a number. The default value is "middle".

Throws:
{Exception}
  If the element cannot be constructed with the given parent objects an exception is thrown.

Examples:

    // Create an axis providing two coord pairs.
      var p1 = board.create('point', [0, 3]);
      var p2 = board.create('point', [1, 3]);
      var l1 = board.create('line', [p1, p2]);
      var t = board.create('ticks', [l1], {ticksDistance: 2});

Field Detail
{String} anchor
Determine the position of the tick with value 0. 'left' means point1 of the line, 'right' means point2, and 'middle' is equivalent to the midpoint of the defining points. This attribute is ignored if the parent line is of type axis and is parallel to either the x (i.e. y = 0) or the y (i.e. x = 0) axis.
Defined in: options.js.

Default Value:
  'left'

{Boolean} drawLabels
Draw labels yes/no
Defined in: options.js.

Default Value:
  false

{Boolean} drawZero
Draw the zero tick, that lies at line.point1?
Defined in: options.js.

Default Value:
  false

{function} generateLabelText
A function that expects two JXG.Coords, the first one representing the coordinates of the tick that is to be labeled, the second one the coordinates of the center (the tick with position 0).
Defined in: options.js.

{function} generateLabelValue
A function that expects two JXG.Coords, the first one representing the coordinates of the tick that is to be labeled, the second one the coordinates of the center (the tick with position 0).
Defined in: options.js.

Deprecated:
Use JGX.Options@generateLabelValue

{Boolean} includeBoundaries
Whether line boundaries should be counted or not in the lower and upper bounds when creating ticks.
Defined in: options.js.

Default Value:
  false

{Boolean} insertTicks
If the distance between two ticks is too big we could insert new ticks. If insertTicks is `true`, we'll do so, otherwise we leave the distance as is. This option is ignored if equidistant is false. In the example below the distance between two ticks is given as `1` but because insertTicks is set to true many ticks will be omitted in the rendering process to keep the display clear.
Defined in: options.js.

    // Create an axis providing two coord pairs.
      var p1 = board.create('point', [0, 0]);
      var p2 = board.create('point', [50, 25]);
      var l1 = board.create('line', [p1, p2]);
      var t = board.create('ticks', [l1, 1], {
         insertTicks: true,
         majorHeight: -1,
         label: {
             offset: [4, -9]
         },
         drawLabels: true
     });

See:
  Ticks#equidistant
  Ticks#minTicksDistance

Default Value:
  false

{Array} labels
User defined labels for special ticks. Instead of the i-th tick's position, the i-th string stored in this array is shown. If the number of strings in this array is less than the number of special ticks, the tick's position is shown as a fallback.
Defined in: options.js.

Default Value:
  []

{Number} majorHeight
Total height of a major tick. If negative the full height of the board is taken.
Defined in: options.js.

Default Value:
  10

{Number} maxLabelLength
The maximum number of characters a tick label can use.
Defined in: options.js.

See:
  Ticks#precision

Default Value:
  5

{Number} minorHeight
Total height of a minor tick. If negative the full height of the board is taken.
Defined in: options.js.

Default Value:
  4

{Number} minorTicks
The number of minor ticks between two major ticks.
Defined in: options.js.

Default Value:
  4

{Number} precision
If a label exceeds JXG.Ticks#maxLabelLength this determines the precision used to shorten the tick label.
Defined in: options.js.

See:
  Ticks#maxLabelLength

Default Value:
  3

{Number} scale
Scale the ticks but not the tick labels.
Defined in: options.js.

See:
  Ticks#scaleSymbol

Default Value:
  1

{String} scaleSymbol
A string that is appended to every tick, used to represent the scale factor given in JXG.Ticks#scaleSymbol.
Defined in: options.js.

See:
  Ticks#scale

Default Value:
  ''

{Array} tickEndings
Decides in which direction finite ticks are visible. Possible values are either the constants 0=false or 1=true or a function returning 0 or 1. In case of [0,1] the tick is only visible to the right of the line. In case of [1,0] the tick is only visible to the left of the line.
Defined in: options.js.

Default Value:
  [1, 1]

{Number} ticksDistance
The default distance between two ticks. Please be aware that this value does not have to be used if JXG.Ticks#insertTicks is set to true.
Defined in: options.js.

See:
  Ticks#equidistant
  Ticks#insertTicks

Default Value:
  1

{Boolean} useUnicodeMinus
Use the unicode character 0x2212, i.e. the HTML entity &minus; as minus sign. That is −1 instead of -1.
Defined in: options.js.

Default Value:
  true