# 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

- Angle
- Arc
- Arrow
- Arrowparallel
- Axis
- Bisector
- Bisectorlines
- Circle
- Circumcenter
- Circumcircle
- CircumcircleArc
- Circumcirclesector
- Conic
- Curve
- Ellipse
- Functiongraph
- Glider
- Grid
- Hyperbola
- Image
- Incenter
- Incircle
- Integral
- Intersection
- Line
- Locus
- Midpoint
- Mirrorpoint
- Normal
- Orthogonalprojection
- OtherIntersection
- Parabola
- Parallel
- Parallelpoint
- Perpendicular
- Perpendicularpoint
- Point
- Polygon
- Reflection
- RegularPolygon
- Riemannsum
- Sector
- Segment
- Semicircle
- Slider
- Tangent
- Text
- Ticks
- Tracecurve

## Classes

- _global_
- JXG
- JXG.AbstractRenderer
- JXG.Board
- JXG.C
- JXG.CanvasRenderer
- JXG.Circle
- JXG.Complex
- JXG.Composition
- JXG.Coords
- JXG.Curve
- JXG.Dump
- 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.Point
- JXG.Polygon
- JXG.Server
- JXG.Server.modules
- JXG.SVGRenderer
- JXG.Text
- JXG.Ticks
- JXG.Turtle
- JXG.Util
- JXG.VMLRenderer

# Class JXG.GeometryElement

↳ JXG.GeometryElement

This is the basic class for geometry elements like points, circles and lines.
Defined in: GeometryElement.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| JXG.GeometryElement(board, attributes, type, oclass) Constructs a new GeometryElement object.

Attributes Summary
Field Attributes | Field Name and Description
--- | ---
| dash Determines the elements border-style.
| draft If true the element will be drawn in grey scale colors to visualize that it's only a draft.
| fillColor The fill color of this geometry element.
| fillOpacity Opacity for fill color.
| fixed If true the element is fixed and can not be dragged around.
| frozen If true the element is fixed and can not be dragged around.
| highlight
| highlightFillColor The fill color of the given geometry element when the mouse is pointed over it.
| highlightFillOpacity Opacity for fill color when the object is highlighted.
| highlightStrokeColor The stroke color of the given geometry element when the user moves the mouse over it.
| highlightStrokeOpacity Opacity for stroke color when the object is highlighted.
| highlightStrokeWidth Width of the element's stroke when the mouse is pointed over it.
| needsRegularUpdate If this is set to true, the element is updated in every update call of the board.
| shadow If true the element will get a shadow.
| strokeColor The stroke color of the given geometry element.
| strokeOpacity Opacity for element's stroke color.
| strokeWidth Width of the element's stroke.
| trace If true the element will be traced, i.e.
| traceAttributes Extra visual properties for traces of an element
| visible If false the element won't be visible on the board, otherwise it is shown.
| withLabel If true a label will display the element's name.

Field Summary
Field Attributes | Field Name and Description
--- | ---
| addEvent Alias of JXG.GeometryElement#on.
| ancestors Elements on which this elements depends on are stored here.
<private> | baseElement TODO
| board Reference to the board associated with the element.
| childElements Stores all dependent objects to be updated when this point is moved.
| descendants Elements depending on this element are stored here.
| dump The element is saved with an explicit entry in the file (`true`) or implicitly via a composition.
<constant> | elementClass The element's class.
| elType The string used with JXG.Board#create
| eventHandlers Stores the eventhandlers attached to the element.
| getAttribute Get the value of the property `key`.
| hasLabel If element has a label subelement then this property will be set to true.
| highlighted True, if the element is currently highlighted.
| id Unique identifier for the element.
| isDraggable Controls if this element can be dragged.
| isReal If element is in two dimensional real space this is true, else false.
| methodMap The methodMap determines which methods can be called from within JessieCode and under which name it can be used.
| mouseover Is the mouse over this element?
| name Not necessarily unique name for the element.
| needsUpdate Controls if updates are necessary
| notExistingParents Stores all Intersection Objects which in this moment are not real and so hide this element.
| numTraces Counts the number of objects drawn as part of the trace of the element.
| quadraticform Quadratic form representation of circles (and conics)
| removeEvent Alias of JXG.GeometryElement#off.
| stdform [c,b0,b1,a,k,r,q0,q1] See A.E.
| subs Subs contains the subelements, created during the create method.
| symbolic Stores variables for symbolic computations
| traces Keeps track of all objects drawn as part of the trace of the element.
| transformations Stores the transformations which are applied during update in an array
<constant> | type Type of the element.
| visProp An associative array containing all visual properties.

Method Summary
Method Attributes | Method Name and Description
--- | ---
<private> | _set(property, value) Sets the value of property `property` to `value`.
| addChild(obj) Add an element as a child to the current element.
<private> | addDescendants(obj) Adds the given object to the descendants list of this object and all its child objects.
| animate(hash, time, options) Animates properties for that object like stroke or fill color, opacity and maybe even more later.
| bounds() Dimensions of the smallest rectangle enclosing the element.
| clearTrace() Removes all objects generated by the trace function.
| cloneToBackground() Copy the element to background.
<private> | countChildren() Counts the direct children of an object without counting labels.
<private> | createGradient() Creates a gradient nodes in the renderer.
| createLabel() Creates a label element for this geometry element.
<private> | draggable() Decides whether an element can be dragged.
<private> | generatePolynomial() Array of strings containing the polynomials defining the element.
| getAttributes() Retrieve a copy of the current visProp.
| getLabelAnchor() Returns the coords object where the label of the element shall be drawn.
| getName() Returns the elements name, Used in JessieCode.
| getParents() List of the element ids resp.
<deprecated> | getProperty(key) Deprecated alias for JXG.GeometryElement#getAttribute.
| getTextAnchor() Returns the coords object where a text that is bound to the element shall be drawn.
| getType() The type of the element as used in JXG.Board#create.
| hasPoint(x, y) Checks whether (x,y) is near the element.
| hideElement() Hide the element.
| labelColor(lColor) Set the labelColor of an element
| noHighlight() Uses the "normal" properties of the element.
<private> | normalize() Normalize the element's standard form.
| off(event, handler) Unregister an event handler.
| on(event, handler) Register a new event handler
<private> | prepareUpdate() Notify all child elements for updates.
| remove() Removes the element from the construction.
| resolveShortcuts(properties) Resolves property shortcuts like `color` and expands them, e.g.
| setArrow(firstArrow, lastArrow) Determines whether the arc has arrows at start or end of the arc.
| setAttribute(attributes) Sets an arbitrary number of attributes.
<private> | setDash(dash) Set the dash style of an object.
| setLabelText(str) Updates the element's label text, strips all html.
<deprecated> | setProperty() Deprecated alias for JXG.GeometryElement#setAttribute.
<private> | setStraight(x, y) TODO Was hat das hier verloren? "Straights" gibts doch nur fuer Lines oder? Sollte das dann nicht nur in Line.js zu finden sein? --michael
| showElement() Make the element visible.
| triggerEventHandlers(event) Triggers all event handlers of this element for a given event.
| update() General update method.
<private> | updateRenderer() Provide updateRenderer method.

Class Detail
JXG.GeometryElement(board, attributes, type, oclass)
Constructs a new GeometryElement object.

Parameters:
board
attributes
type
oclass

Attribute Detail
{Number} dash
Determines the elements border-style. Possible values are:

- 0 for a solid line
- 1 for a dotted line
- 2 for a line with small dashes
- 3 for a line with medium dashes
- 4 for a line with big dashes
- 5 for a line with alternating medium and big dashes and large gaps
- 6 for a line with alternating medium and big dashes and small gaps

Defined in: Options.js.

Default Value:
  0

{boolean} draft
If true the element will be drawn in grey scale colors to visualize that it's only a draft.
Defined in: Options.js.

{String} fillColor
The fill color of this geometry element.
Defined in: Options.js.

See:
  JXG.GeometryElement#highlightFillColor
  JXG.GeometryElement#fillOpacity
  JXG.GeometryElement#highlightFillOpacity

{number} fillOpacity
Opacity for fill color.
Defined in: Options.js.

See:
  JXG.GeometryElement#fillColor
  JXG.GeometryElement#highlightFillColor
  JXG.GeometryElement#highlightFillOpacity

{Boolean} fixed
If true the element is fixed and can not be dragged around. The element will be repositioned on zoom and moveOrigin events.
Defined in: Options.js.

Default Value:
  false

{Boolean} frozen
If true the element is fixed and can not be dragged around. The element will even stay at its position on zoom and moveOrigin events. Only free elements like points, texts, curves can be frozen.
Defined in: Options.js.

Default Value:
  false

{Boolean} highlight
Defined in: Options.js.

Default Value:
  true

{String} highlightFillColor
The fill color of the given geometry element when the mouse is pointed over it.
Defined in: Options.js.

See:
  JXG.GeometryElement#fillColor
  JXG.GeometryElement#fillOpacity
  JXG.GeometryElement#highlightFillOpacity

{number} highlightFillOpacity
Opacity for fill color when the object is highlighted.
Defined in: Options.js.

See:
  JXG.GeometryElement#fillColor
  JXG.GeometryElement#highlightFillColor
  JXG.GeometryElement#fillOpacity

{String} highlightStrokeColor
The stroke color of the given geometry element when the user moves the mouse over it.
Defined in: Options.js.

See:
  JXG.GeometryElement#strokeColor
  JXG.GeometryElement#strokeWidth
  JXG.GeometryElement#strokeOpacity
  JXG.GeometryElement#highlightStrokeOpacity

{number} highlightStrokeOpacity
Opacity for stroke color when the object is highlighted.
Defined in: Options.js.

See:
  JXG.GeometryElement#strokeColor
  JXG.GeometryElement#highlightStrokeColor
  JXG.GeometryElement#strokeWidth
  JXG.GeometryElement#strokeOpacity

{number} highlightStrokeWidth
Width of the element's stroke when the mouse is pointed over it.
Defined in: Options.js.

See:
  JXG.GeometryElement#strokeColor
  JXG.GeometryElement#highlightStrokeColor
  JXG.GeometryElement#strokeOpacity
  JXG.GeometryElement#highlightStrokeOpacity
  JXG.GeometryElement#highlightFillColor

{Boolean} needsRegularUpdate
If this is set to true, the element is updated in every update call of the board. If set to false, the element is updated only after zoom events or more generally, when the bounding box has been changed. Examples for the latter behaviour should be axes.
Defined in: Options.js.

See:
  JXG.GeometryElement#needsRegularUpdate

Default Value:
  true

{boolean} shadow
If true the element will get a shadow.
Defined in: Options.js.

Default Value:
  false

{String} strokeColor
The stroke color of the given geometry element.
Defined in: Options.js.

See:
  JXG.GeometryElement#highlightStrokeColor
  JXG.GeometryElement#strokeWidth
  JXG.GeometryElement#strokeOpacity
  JXG.GeometryElement#highlightStrokeOpacity

{number} strokeOpacity
Opacity for element's stroke color.
Defined in: Options.js.

See:
  JXG.GeometryElement#strokeColor
  JXG.GeometryElement#highlightStrokeColor
  JXG.GeometryElement#strokeWidth
  JXG.GeometryElement#highlightStrokeOpacity

{number} strokeWidth
Width of the element's stroke.
Defined in: Options.js.

See:
  JXG.GeometryElement#strokeColor
  JXG.GeometryElement#highlightStrokeColor
  JXG.GeometryElement#strokeOpacity
  JXG.GeometryElement#highlightStrokeOpacity

{Boolean} trace
If true the element will be traced, i.e. on every movement the element will be copied to the background. Use JXG.GeometryElement#clearTrace to delete the trace elements.
Defined in: Options.js.

See:
  JXG.GeometryElement#clearTrace
  JXG.GeometryElement#traces
  JXG.GeometryElement#numTraces

Default Value:
  false

{Object} traceAttributes
Extra visual properties for traces of an element
Defined in: Options.js.

See:
  JXG.GeometryElement#trace

{boolean} visible
If false the element won't be visible on the board, otherwise it is shown.
Defined in: Options.js.

See:
  JXG.GeometryElement#hideElement
  JXG.GeometryElement#showElement

Default Value:
  true

{Boolean} withLabel
If true a label will display the element's name.
Defined in: Options.js.

Default Value:
  false

Field Detail
addEvent
Alias of JXG.GeometryElement#on.

{Object} ancestors
Elements on which this elements depends on are stored here.

<private> {JXG.GeometryElement} baseElement
TODO

Default Value:
  null

{JXG.Board} board
Reference to the board associated with the element.

{Object} childElements
Stores all dependent objects to be updated when this point is moved.

{Object} descendants
Elements depending on this element are stored here.

{Boolean} dump
The element is saved with an explicit entry in the file (`true`) or implicitly via a composition.

Default Value:
  true

<constant> {number} elementClass
The element's class.

{String} elType
The string used with JXG.Board#create

{Object} eventHandlers
Stores the eventhandlers attached to the element.

getAttribute
Get the value of the property `key`.

{Boolean} hasLabel
If element has a label subelement then this property will be set to true.

Default Value:
  false

{Boolean} highlighted
True, if the element is currently highlighted.

Default Value:
  false

{String} id
Unique identifier for the element. Equivalent to id-attribute of renderer element.

{Boolean} isDraggable
Controls if this element can be dragged. In GEONExT only free points and gliders can be dragged.

Default Value:
  false

{Boolean} isReal
If element is in two dimensional real space this is true, else false.

Default Value:
  true

{Object} methodMap
The methodMap determines which methods can be called from within JessieCode and under which name it can be used. The map is saved in an object, the name of a property is the name of the method used in JessieCode, the value of a property is the name of the method in JavaScript.

{Boolean} mouseover
Is the mouse over this element?

Default Value:
  false

{String} name
Not necessarily unique name for the element.

See:
  JXG.Board#generateName

Default Value:
  Name generated by JXG.Board#generateName.

{Boolean} needsUpdate
Controls if updates are necessary

Default Value:
  true

{Object} notExistingParents
Stores all Intersection Objects which in this moment are not real and so hide this element.

{Number} numTraces
Counts the number of objects drawn as part of the trace of the element.

See:
  JXG.GeometryElement#traced
  JXG.GeometryElement#clearTrace
  JXG.GeometryElement#traces

{Array} quadraticform
Quadratic form representation of circles (and conics)

Default Value:
  [[1,0,0],[0,1,0],[0,0,1]]

removeEvent
Alias of JXG.GeometryElement#off.

{Array} stdform
[c,b0,b1,a,k,r,q0,q1] See A.E. Middleditch, T.W. Stacey, and S.B. Tor: "Intersection Algorithms for Lines and Circles", ACM Transactions on Graphics, Vol. 8, 1, 1989, pp 25-40. The meaning of the parameters is: Circle: points p=[p0,p1] on the circle fulfill a<p,p> + <b,p> + c = 0 For convenience we also store r: radius k: discriminant = sqrt(<b,b>-4ac) q=[q0,q1] center Points have radius = 0. Lines have radius = infinity. b: normalized vector, representing the direction of the line. Should be put into Coords, when all elements possess Coords.

Default Value:
  [1, 0, 0, 0, 1, 1, 0, 0]

{Object} subs
Subs contains the subelements, created during the create method.

{Object} symbolic
Stores variables for symbolic computations

{Object} traces
Keeps track of all objects drawn as part of the trace of the element.

See:
  JXG.GeometryElement#traced
  JXG.GeometryElement#clearTrace
  JXG.GeometryElement#numTraces

{Array} transformations
Stores the transformations which are applied during update in an array

See:
  JXG.Transformation

<constant> {number} type
Type of the element.

{Object} visProp
An associative array containing all visual properties.

Default Value:
  empty object

Method Detail
<private> _set(property, value)
Sets the value of property `property` to `value`.

Parameters:
{String} property
  The property's name.
{%} value
  The new value

addChild(obj)
Add an element as a child to the current element. Can be used to model dependencies between geometry elements.

Parameters:
{JXG.GeometryElement} obj
  The dependent object.

<private> addDescendants(obj)
Adds the given object to the descendants list of this object and all its child objects.

Parameters:
{JXG.GeometryElement} obj
  The element that is to be added to the descendants list.

Returns:

{JXG.GeometryElement} animate(hash, time, options)
Animates properties for that object like stroke or fill color, opacity and maybe even more later.

Parameters:
{Object} hash
  Object containing propiertes with target values for the animation.
{number} time
  Number of milliseconds to complete the animation.
{Object} options Optional
  Optional settings for the animation:
  - callback: A function that is called as soon as the animation is finished.

Returns:
  A reference to the object

{Array} bounds()
Dimensions of the smallest rectangle enclosing the element.

Returns:
  {Array} The coordinates of the enclosing rectangle in a format like the bounding box in JXG.Board#setBoundingBox.

clearTrace()
Removes all objects generated by the trace function.

{JXG.GeometryElement} cloneToBackground()
Copy the element to background. This is used for tracing elements.

Returns:
  {JXG.GeometryElement} A reference to the element

<private> {number} countChildren()
Counts the direct children of an object without counting labels.

Returns:
  {number} Number of children

<private> createGradient()
Creates a gradient nodes in the renderer.

See:
  JXG.SVGRenderer#setGradient

createLabel()
Creates a label element for this geometry element.

See:
  #addLabelToElement

<private> {boolean} draggable()
Decides whether an element can be dragged. This is used in setPositionDirectly methods where all parent elements are checked if they may be dragged, too.

Returns:
  {boolean}

<private> {Array} generatePolynomial()
Array of strings containing the polynomials defining the element. Used for determining geometric loci the groebner way.

Returns:
  An array containing polynomials describing the locus of the current object.

{Object} getAttributes()
Retrieve a copy of the current visProp.

Returns:
  {Object}

{JXG.Coords} getLabelAnchor()
Returns the coords object where the label of the element shall be drawn. Differs in some cases from the values that getTextAnchor returns.

Returns:
  {JXG.Coords} JXG.Coords Place where the text shall be drawn.

See:
  JXG.GeometryElement#getTextAnchor

{String} getName()
Returns the elements name, Used in JessieCode.

Returns:
  {String}

{Array} getParents()
List of the element ids resp. values used as parents in JXG.Board#create.

Returns:
  {Array}

getProperty(key)
Deprecated alias for JXG.GeometryElement#getAttribute.

Parameters:
key

Deprecated:
Use JXG.GeometryElement#getAttribute.

{JXG.Coords} getTextAnchor()
Returns the coords object where a text that is bound to the element shall be drawn. Differs in some cases from the values that getLabelAnchor returns.

Returns:
  {JXG.Coords} JXG.Coords Place where the text shall be drawn.

See:
  JXG.GeometryElement#getLabelAnchor

{String} getType()
The type of the element as used in JXG.Board#create.

Returns:
  {String}

{Boolean} hasPoint(x, y)
Checks whether (x,y) is near the element.

Parameters:
{Number} x
  Coordinate in x direction, screen coordinates.
{Number} y
  Coordinate in y direction, screen coordinates.

Returns:
  {Boolean} True if (x,y) is near the element, False otherwise.

hideElement()
Hide the element. It will still exist but not visible on the board.

labelColor(lColor)
Set the labelColor of an element

Parameters:
{String} lColor
  String which determines the text color of an object's label.

See:
  JXG.GeometryElement#labelColor

noHighlight()
Uses the "normal" properties of the element.

<private> normalize()
Normalize the element's standard form.

off(event, handler)
Unregister an event handler.

Parameters:
{String} event
{Function} handler
  The same function used in JXG.GeometryElement#on.

on(event, handler)
Register a new event handler

Parameters:
{String} event
{Function} handler

<private> prepareUpdate()
Notify all child elements for updates.

remove()
Removes the element from the construction. This only removes the SVG or VML node of the element and its label (if available) from the renderer, to remove the element completely you should use JXG.Board#removeObject.

{Object} resolveShortcuts(properties)
Resolves property shortcuts like `color` and expands them, e.g. `strokeColor` and `fillColor`. Writes the expanded properties back to the given `properties`.

Parameters:
{Object} properties

Returns:
  {Object} The given parameter with shortcuts expanded.

setArrow(firstArrow, lastArrow)
Determines whether the arc has arrows at start or end of the arc.

Parameters:
{bool} firstArrow
  True if there is an arrow at the start of the arc, false otherwise.
{bool} lastArrow
  True if there is an arrow at the end of the arc, false otherwise. Is stored at visProp['firstarrow'] and visProp['lastarrow']

setAttribute(attributes)
Sets an arbitrary number of attributes.

Parameters:
{Object} attributes
  An object with attributes.

Examples:

    // Set property directly on creation of an element using the attributes object parameter
    var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 5, 5, 1]};
    var p = board.create('point', [2, 2], {visible: false});

    // Now make this point visible and fixed:
    p.setProperty({
        fixed: true,
        visible: true
    });

<private> setDash(dash)
Set the dash style of an object. See #dash for a list of available dash styles. You should use #setProperty instead of this method.

Parameters:
{number} dash
  Indicates the new dash style

setLabelText(str)
Updates the element's label text, strips all html.

Parameters:
{String} str

setProperty()
Deprecated alias for JXG.GeometryElement#setAttribute.

Deprecated:
Use JXG.GeometryElement#setAttribute.

<private> setStraight(x, y)
TODO Was hat das hier verloren? "Straights" gibts doch nur fuer Lines oder? Sollte das dann nicht nur in Line.js zu finden sein? --michael

Parameters:
x
y

showElement()
Make the element visible.

triggerEventHandlers(event)
Triggers all event handlers of this element for a given event.

Parameters:
{String} event

update()
General update method. Should be overwritten by the element itself. Can be used sometimes to commit changes to the object.

<private> updateRenderer()
Provide updateRenderer method.

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Apr 02 2012 17:54:07 GMT+0200 (MESZ)