Class JXG.GeometryElement
↳ JXG.GeometryElement
This is the basic class for geometry elements like points, circles and lines.
Defined in: element.js.
Constructor Attributes | Constructor Name and Description |
---|---|
JXG.GeometryElement(board, attributes, type, oclass)
Constructs a new GeometryElement object.
|
Field Attributes | Field Name and Description |
---|---|
Determines the elements border-style.
|
|
If true, the dash pattern is multiplied by strokeWidth / 2.
|
|
If draft.draft: true the element will be drawn in grey scale colors (as default)
to visualize that it's only a draft.
|
|
If the element is dragged it will be moved on mousedown or touchstart to the
top of its layer.
|
|
The fill color of this geometry element.
|
|
Opacity for fill color.
|
|
If true the element is fixed and can not be dragged around.
|
|
If true the element is fixed and can not be dragged around.
|
|
Gradient type.
|
|
Angle (in radians) of the gradiant in case the gradient is of type 'linear'.
|
|
From the SVG specification: ‘cx’, ‘cy’ and ‘r’ define the largest (i.e.
|
|
From the SVG specification: ‘cx’, ‘cy’ and ‘r’ define the largest (i.e.
|
|
The gradientEndOffset attribute is a number (ranging from 0 to 1) which indicates where the second gradient stop is placed,
see the SVG specification for more information.
|
|
This attribute defines the radius of the start circle of the radial gradient.
|
|
‘fx’ and ‘fy’ define the focal point for the radial gradient.
|
|
y-coordinate of the circle center for the second color in case of gradient 'radial'.
|
|
From the SVG specification: ‘cx’, ‘cy’ and ‘r’ define the largest (i.e.
|
|
Second color for gradient.
|
|
Opacity of second gradient color.
|
|
The gradientStartOffset attribute is a number (ranging from 0 to 1) which indicates where the first gradient stop is placed,
see the SVG specification for more information.
|
|
The fill color of the given geometry element when the mouse is pointed over it.
|
|
Opacity for fill color when the object is highlighted.
|
|
The stroke color of the given geometry element when the user moves the mouse over it.
|
|
Opacity for stroke color when the object is highlighted.
|
|
Width of the element's stroke when the mouse is pointed over it.
|
|
<private> | |
Display layer which will contain the element.
|
|
Line endings (linecap) of a stroke element, i.e.
|
|
If this is set to true, the element is updated in every update
call of the board.
|
|
If some size of an element is controlled by a function, like the circle radius
or segments of fixed length, this attribute controls what happens if the value
is negative.
|
|
Precision options for JSXGraph elements.
|
|
A private element will be inaccessible in certain environments, e.g.
|
|
Determines whether two-finger manipulation may rotate this object.
|
|
Determines whether two-finger manipulation of this object may change its size.
|
|
If enabled:true the (stroke) element will get a customized shadow.
|
|
Snaps the element or its parents to the grid.
|
|
The stroke color of the given geometry element.
|
|
Opacity for element's stroke color.
|
|
Width of the element's stroke.
|
|
Controls if an element can get the focus with the tab key.
|
|
If true the element will be traced, i.e.
|
|
Extra visual properties for traces of an element
|
|
Transition duration (in milliseconds) for certain cahnges of properties like color and opacity.
|
|
Properties which change smoothly in the time set in transitionDuration.
|
|
Set individual viewport for an element.
|
|
If false the element won't be visible on the board, otherwise it is shown.
|
|
If true a label will display the element's name.
|
Field Attributes | Field Name and Description |
---|---|
<private> <constant> |
Original type of the element at construction time.
|
<private> |
The position of this element inside the JXG.Board#objectsList.
|
Elements on which this element depends on are stored here.
|
|
<private> | |
Reference to the board associated with the element.
|
|
Stores all dependent objects to be updated when this point is moved.
|
|
Elements depending on this element are stored here.
|
|
The element is saved with an explicit entry in the file (true) or implicitly
via a composition.
|
|
<constant> |
The element's class.
|
The string used with JXG.Board#create
|
|
If element has a label subelement then this property will be set to true.
|
|
True, if the element is currently highlighted.
|
|
Unique identifier for the element.
|
|
Inherits contains the subelements, which may have an attribute
(in particular the attribute "visible") having value 'inherit'.
|
|
Controls if this element can be dragged.
|
|
If element is in two dimensional real space this is true, else false.
|
|
Time stamp containing the last time this element has been dragged.
|
|
The methodMap determines which methods can be called from within JessieCode and under which name it
can be used.
|
|
Is the mouse over this element?
|
|
Not necessarily unique name for the element.
|
|
Controls if updates are necessary
|
|
Stores all Intersection Objects which in this moment are not real and
so hide this element.
|
|
Counts the number of objects drawn as part of the trace of the element.
|
|
Ids of elements on which this element depends directly are stored here.
|
|
Quadratic form representation of circles (and conics)
|
|
Stores the SVG (or VML) rendering node for the element.
|
|
[c, b0, b1, a, k, r, q0, q1]
See
A.E.
|
|
Subs contains the subelements, created during the create method.
|
|
Stores variables for symbolic computations
|
|
Keeps track of all objects drawn as part of the trace of the element.
|
|
Stores the transformations which are applied during update in an array
|
|
<constant> |
Type of the element.
|
An associative array containing all visual properties.
|
|
An associative array containing visual properties which are calculated from
the attribute values (i.e.
|
Method Attributes | Method Name and Description |
---|---|
<private> |
_set(key, value)
Sets the value of attribute key to value.
|
addChild(obj)
Add an element as a child to the current element.
|
|
<private> |
addDescendants(obj)
|
<static> |
JXG.GeometryElement.addEvent()
Alias of JXG.EventEmitter.on.
|
addParents(parents)
Adds ids of elements to the array this.parents.
|
|
<private> |
addParentsFromJCFunctions(function_array)
Add dependence on elements in JessieCode functions.
|
addRotation(angle)
Rotate texts or images by a given degree.
|
|
addTicks(ticks)
Adds ticks to this line or curve.
|
|
addTransform(transform)
Add transformations to this element.
|
|
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.
|
|
Removes all objects generated by the trace function.
|
|
Copy the element to background.
|
|
<private> |
Counts the direct children of an object without counting labels.
|
<private> |
Creates a gradient nodes in the renderer.
|
Creates a label element for this geometry element.
|
|
<private> |
Decides whether an element can be dragged.
|
formatNumberLocale(value, digits)
Format a number according to the locale set in the attribute "intl".
|
|
<private> |
fullUpdate(visible)
Run through the full update chain of an element.
|
Array of strings containing the polynomials defining the element.
|
|
getAttribute(key)
Get the value of the property key.
|
|
Retrieve a copy of the current visProp.
|
|
Returns the coords object where the label of the element shall be drawn.
|
|
getName()
Returns the elements name.
|
|
List of the element ids resp.
|
|
<deprecated> |
Deprecated alias for JXG.GeometryElement#getAttribute.
|
<private> |
Determine values of snapSizeX and snapSizeY.
|
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.
|
|
handleSnapToGrid(force, fromParent)
Move an element to its nearest grid point.
|
|
hasPoint(x, y)
Checks whether (x,y) is near the element.
|
|
hide()
Hide the element.
|
|
Hide the element.
|
|
Uses the "normal" properties of the element.
|
|
<private> |
Normalize the element's standard form.
|
<private> |
Notify all child elements for updates.
|
remove()
Removes the element from the construction.
|
|
Removes all ticks from a line or curve.
|
|
removeChild(obj)
Remove an element as a child from the current element.
|
|
<private> |
removeDescendants(obj)
Removes the given object from the descendants list of this object and all its child objects.
|
<static> |
JXG.GeometryElement.removeEvent()
Alias of JXG.EventEmitter.off.
|
removeTicks(tick)
Removes ticks identified by parameter named tick from this line or curve.
|
|
<private> |
resolveShortcuts(attributes)
Resolves attribute shortcuts like color and expands them, e.g.
|
setArrow(firstArrow, lastArrow)
Determines whether the element 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.
|
<private> |
setDisplayRendNode(val)
Show the element or hide it.
|
setLabel(str)
Sets a label and its text
If label doesn't exist, it creates one
|
|
setLabelText(str)
Updates the element's label text, strips all html.
|
|
setName(str)
Updates the element's label text and the element's attribute "name", strips all html.
|
|
setParents(parents)
Sets ids of elements to the array this.parents.
|
|
setPosition(method, coords)
Translates the object by (x, y).
|
|
setPositionDirectly(method, coords, oldcoords)
Moves an element by the difference of two coordinates.
|
|
<deprecated> |
Deprecated alias for JXG.GeometryElement#setAttribute.
|
show()
Make the element visible.
|
|
Make the element visible.
|
|
<private> |
Snaps the element to points.
|
update()
General update method.
|
|
<private> |
Provide updateRenderer method.
|
<private> |
updateVisibility(parent_val)
Set the visibility of an element.
|
Checks if locale is enabled in the attribute.
|
Event Attributes | Event Name and Description |
---|---|
attribute(o, el)
Notify every time an attribute is changed.
|
|
attribute:key(val, nval, el)
This is a generic event handler.
|
|
down(e)
Whenever the user starts to touch or click an element.
|
|
drag(e)
This event is fired whenever the user drags an element.
|
|
keydrag(e)
This event is fired whenever the user drags the element by pressing arrow keys
on the keyboard.
|
|
mousedown(e)
Whenever the user starts to click an element.
|
|
mousedrag(e)
This event is fired whenever the user drags the element with a mouse.
|
|
mousemove(e)
This event is fired whenever the user is moving the mouse over an element.
|
|
mouseout(e)
This event is fired whenever the user puts the mouse away from an element.
|
|
mouseover(e)
This event is fired whenever the user puts the mouse over an element.
|
|
mouseup(e)
Whenever the user releases the mousebutton over an element.
|
|
move(e)
This event is fired whenever the user is moving over an element.
|
|
out(e)
This event is fired whenever the user is leaving an element.
|
|
over(e)
This event is fired whenever the user is hovering over an element.
|
|
pendown(e)
Whenever the user taps an element with the pen.
|
|
pendrag(e)
This event is fired whenever the user drags the element with a pen.
|
|
penup(e)
Whenever the user lifts the pen over an element.
|
|
touchdown(e)
Whenever the user starts to touch an element.
|
|
touchdrag(e)
This event is fired whenever the user drags the element on a touch device.
|
|
touchup(e)
Whenever the user stops touching an element.
|
|
up(e)
Whenever the user stops to touch or click an element.
|
- Parameters:
- {JXG.Board} board
- Reference to the board the element is constructed on.
- {Object} attributes
- Hash of attributes and their values.
- {Number} type
- Element type (a JXG.OBJECT_TYPE_ value).
- {Number} oclass
- The element's class (a JXG.OBJECT_CLASS_ value).
- 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
- 7 for a dotted line. Needs JXG.GeometryElement#linecap set to "round" for round dots.
Defined in: options.js.
- Default Value:
- 0
Defined in: options.js.
- Default Value:
- false
Defined in: options.js.
- Default Value:
- JXG.Options.elements.draft#draft
Defined in: options.js.
var li1 = board.create('line', [1, 1, 1], {strokeWidth: 20, dragToTopOfLayer: true}); var li2 = board.create('line', [1, -1, 1], {strokeWidth: 20, strokeColor: 'red'});
- Default Value:
- false
Defined in: options.js.
- See:
- JXG.GeometryElement#highlightFillColor
- JXG.GeometryElement#fillOpacity
- JXG.GeometryElement#highlightFillOpacity
- Default Value:
- JXG.palette.red
Defined in: options.js.
- See:
- JXG.GeometryElement#fillColor
- JXG.GeometryElement#highlightFillColor
- JXG.GeometryElement#highlightFillOpacity
- Default Value:
- 1
Defined in: options.js.
- Default Value:
- false
Defined in: options.js.
var txt = board.create('text', [1, 2, 'Hello'], {frozen: true, fontSize: 24}); var sli = board.create('slider', [[-4, 4], [-1.5, 4], [-10, 1, 10]], { name:'a', point1: {frozen: true}, point2: {frozen: true} });
- Default Value:
- false
Defined in: options.js.
var a = board.create('slider', [[0, -0.2], [3.5, -0.2], [0, 0, 2 * Math.PI]], {name: 'angle'}); var b = board.create('slider', [[0, -0.4], [3.5, -0.4], [0, 0, 1]], {name: 'offset1'}); var c = board.create('slider', [[0, -0.6], [3.5, -0.6], [0, 1, 1]], {name: 'offset2'}); var pol = board.create('polygon', [[0, 0], [4, 0], [4,4], [0,4]], { fillOpacity: 1, fillColor: 'yellow', gradient: 'linear', gradientSecondColor: 'blue', gradientAngle: function() { return a.Value(); }, gradientStartOffset: function() { return b.Value(); }, gradientEndOffset: function() { return c.Value(); }, hasInnerPoints: true });
var cx = board.create('slider', [[0, -.2], [3.5, -.2], [0, 0.5, 1]], {name: 'cx, cy'}); var fx = board.create('slider', [[0, -.4], [3.5, -.4], [0, 0.5, 1]], {name: 'fx, fy'}); var o1 = board.create('slider', [[0, -.6], [3.5, -.6], [0, 0.0, 1]], {name: 'offset1'}); var o2 = board.create('slider', [[0, -.8], [3.5, -.8], [0, 1, 1]], {name: 'offset2'}); var r = board.create('slider', [[0, -1], [3.5, -1], [0, 0.5, 1]], {name: 'r'}); var fr = board.create('slider', [[0, -1.2], [3.5, -1.2], [0, 0, 1]], {name: 'fr'}); var pol = board.create('polygon', [[0, 0], [4, 0], [4,4], [0,4]], { fillOpacity: 1, fillColor: 'yellow', gradient: 'radial', gradientSecondColor: 'blue', gradientCX: function() { return cx.Value(); }, gradientCY: function() { return cx.Value(); }, gradientR: function() { return r.Value(); }, gradientFX: function() { return fx.Value(); }, gradientFY: function() { return fx.Value(); }, gradientFR: function() { return fr.Value(); }, gradientStartOffset: function() { return o1.Value(); }, gradientEndOffset: function() { return o2.Value(); }, hasInnerPoints: true });
- Default Value:
- null
Defined in: options.js.
- Default Value:
- 0
Defined in: options.js.
- Default Value:
- 0.5
Defined in: options.js.
- Default Value:
- 0.5
Defined in: options.js.
- Default Value:
- 1.0
Defined in: options.js.
- Default Value:
- 0.0
Defined in: options.js.
- Default Value:
- 0.5
Defined in: options.js.
- Default Value:
- 0.5
Defined in: options.js.
- Default Value:
- 0.5
Defined in: options.js.
- Default Value:
- '#ffffff'
Defined in: options.js.
- Default Value:
- 1
Defined in: options.js.
- Default Value:
- 0.0
Defined in: options.js.
- Default Value:
- true
Defined in: options.js.
- See:
- JXG.GeometryElement#fillColor
- JXG.GeometryElement#fillOpacity
- JXG.GeometryElement#highlightFillOpacity
- Default Value:
- 'none'
Defined in: options.js.
- See:
- JXG.GeometryElement#fillColor
- JXG.GeometryElement#highlightFillColor
- JXG.GeometryElement#fillOpacity
- Default Value:
- 1
Defined in: options.js.
- See:
- JXG.GeometryElement#strokeColor
- JXG.GeometryElement#strokeWidth
- JXG.GeometryElement#strokeOpacity
- JXG.GeometryElement#highlightStrokeOpacity
- Default Value:
- '#c3d9ff'
Defined in: options.js.
- See:
- JXG.GeometryElement#strokeColor
- JXG.GeometryElement#highlightStrokeColor
- JXG.GeometryElement#strokeWidth
- JXG.GeometryElement#strokeOpacity
- Default Value:
- 1
Defined in: options.js.
- See:
- JXG.GeometryElement#strokeColor
- JXG.GeometryElement#highlightStrokeColor
- JXG.GeometryElement#strokeOpacity
- JXG.GeometryElement#highlightStrokeOpacity
- JXG.GeometryElement#highlightFillColor
- Default Value:
- 2
Defined in: options.js.
- Default Value:
- false
Defined in: options.js.
- See:
- JXG.Options#layer
- Default Value:
- See JXG.Options#layer
- 'butt',
- 'round',
- 'square'.
Defined in: options.js.
- Default Value:
- 'butt'
Defined in: options.js.
- Default Value:
- true
Defined in: options.js.
var slider = board.create('slider', [[4, -3], [4, 3], [-4, 1, 4]], { name: 'a'}); var circle = board.create('circle', [[-1, 0], 1], { nonnegativeOnly: true }); circle.setRadius('a'); // Use JessieCode var seg = board.create('segment', [[-4, 3], [0, 3], () => slider.Value()], { point1: {visible: true}, point2: {visible: true}, nonnegativeOnly: true });
- Default Value:
- false
precision: { touch: 30, mouse: 4, pen: 4 }In the first case, the global, JSXGraph-wide values of JXGraph.Options.precision are taken.
Defined in: options.js.
- Default Value:
- 'inherit'
Defined in: options.js.
- Default Value:
- false
In case the element is a polygon or line and it has the attribute "rotatable:false", moving the element with two fingers results in a rotation or translation.
If an element is set to be neither scalable nor rotatable, it can only be translated.
In case of a polygon, scaling is only possible if no vertex has snapToGrid or snapToPoints
enabled and no vertex is fixed by some other constraint. Also, the polygon itself has to have
snapToGrid disabled.
Defined in: options.js.
- Default Value:
- true
In case the element is a horizontal or vertical line having ticks, "scalable:true" enables zooming of the board by dragging ticks lines. This feature is enabled, for the ticks element of the line element the attribute "fixed" has to be false and the line element's scalable attribute has to be true.
In case the element is a polygon or line and it has the attribute "scalable:false", moving the element with two fingers results in a rotation or translation.
If an element is set to be neither scalable nor rotatable, it can only be translated.
In case of a polygon, scaling is only possible if no vertex has snapToGrid or snapToPoints
enabled and no vertex is fixed by some other constraint. Also, the polygon itself has to have
snapToGrid disabled.
Defined in: options.js.
- See:
- JXG.Ticks#fixed
- JXG.GeometryElement#rotatable
- Default Value:
- true
Customize color and opacity:
If the object's RGB stroke color is [r,g,b] and its opacity is op, and
the shadow parameters color is given as [r', g', b'] and opacity as op'
the shadow will receive the RGB color
This attribute is only available with SVG, not with canvas.
Defined in: options.js.
board.options.line.strokeWidth = 2 // No shadow var li1 = board.create('line', [[-2, 5], [2, 6]], {strokeColor: 'red', shadow: false}); // Default shadow var li2 = board.create('line', [[-2, 3], [2, 4]], {strokeColor: 'red', shadow: true}); // No shadow var li3 = board.create('line', [[-2, 1], [2, 2]], {strokeColor: 'blue', shadow: {enabled: false}}); // Shadow uses same color as line var li4 = board.create('line', [[-2, -1], [2, 0]], {strokeColor: 'blue', shadow: {enabled: true, color: '#000000', blend: 1} }); // Shadow color as a mixture between black and the line color, additionally set opacity var li5 = board.create('line', [[-2, -3], [2, -2]], {strokeColor: 'blue', shadow: {enabled: true, color: '#000000', blend: 0.5, opacity: 0.5} }); // Use different value for blur and offset [dx, dy] var li6 = board.create('line', [[-2, -5], [2, -4]], {strokeColor: 'blue', shadow: {enabled: true, offset:[0, 25], blur: 6} });
- Default Value:
- shadow: { enabled: false, color: [0, 0, 0], opacity: 1, blur: 3, blend: 0.1, offset: [5, 5] }
Defined in: options.js.
- Default Value:
- false
Defined in: options.js.
- See:
- JXG.GeometryElement#highlightStrokeColor
- JXG.GeometryElement#strokeWidth
- JXG.GeometryElement#strokeOpacity
- JXG.GeometryElement#highlightStrokeOpacity
- Default Value:
- JXG.palette.blue
Defined in: options.js.
- See:
- JXG.GeometryElement#strokeColor
- JXG.GeometryElement#highlightStrokeColor
- JXG.GeometryElement#strokeWidth
- JXG.GeometryElement#highlightStrokeOpacity
- Default Value:
- 1
Defined in: options.js.
- See:
- JXG.GeometryElement#strokeColor
- JXG.GeometryElement#highlightStrokeColor
- JXG.GeometryElement#strokeOpacity
- JXG.GeometryElement#highlightStrokeOpacity
- Default Value:
- 2
Defined in: options.js.
- Default Value:
- 0
Defined in: options.js.
- See:
- JXG.GeometryElement#clearTrace
- JXG.GeometryElement#traces
- JXG.GeometryElement#numTraces
- JXG.GeometryElement#traceAttributes
- Default Value:
- false
Defined in: options.js.
JXG.Options.elements.traceAttributes = { size: 2 }; const board = JXG.JSXGraph.initBoard(BOARDID, { boundingbox: [-4, 4, 4, -4], keepaspectratio: true }); var p = board.create('point', [0.0, 2.0], { trace: true, size: 10, traceAttributes: { color: 'black', face: 'x' } });
- Default Value:
- {}
Defined in: options.js.
- See:
- JXG.GeometryElement#transitionProperties
- JXG.GeometryElement#strokeColor
- JXG.GeometryElement#highlightStrokeColor
- JXG.GeometryElement#strokeOpacity
- JXG.GeometryElement#highlightStrokeOpacity
- JXG.GeometryElement#fillColor
- JXG.GeometryElement#highlightFillColor
- JXG.GeometryElement#fillOpacity
- JXG.GeometryElement#highlightFillOpacity
- Default Value:
- 100 JXG.Options.elements#transitionDuration
Defined in: options.js.
var p1 = board.create("point", [0, 2], { name: "A", highlightStrokeWidth: 10, transitionDuration: 1000, transitionProperties: ['width', 'height', 'stroke-width', 'fill', 'fill-opacity', 'rx', 'ry', 'stroke', 'stroke-opacity'] });
Defined in: options.js.
- See:
- JXG.Board#viewport
- Default Value:
- 'inherit'
Defined in: options.js.
- Default Value:
- true
Defined in: options.js.
- Default Value:
- false
- Default Value:
- -1
- Default Value:
- null
- Default Value:
- true
- Default Value:
- false
- Default Value:
- false
- Default Value:
- false
- Default Value:
- true
- Default Value:
- creation time
- Default Value:
- false
- Default Value:
- Name generated by JXG.Board#generateName.
- Default Value:
- true
- Default Value:
- [[1,0,0],[0,1,0],[0,0,1]]
- Elements with arrow tail or head: rendNodeTriangleStart, rendNodeTriangleEnd
- SVG (or VML) texts: rendNodeText
- Button: rendNodeForm, rendNodeButton, rendNodeTag
- Checkbox: rendNodeForm, rendNodeCheckbox, rendNodeLabel, rendNodeTag
- Input: rendNodeForm, rendNodeInput, rendNodeLabel, rendNodeTag
var p1 = board.create('point', [0, 0]); console.log(p1.rendNode); // returns the full SVG node details of the point p1, something like: // <ellipse id='box_jxgBoard1P6' stroke='#ff0000' stroke-opacity='1' stroke-width='2px' // fill='#ff0000' fill-opacity='1' cx='250' cy='250' rx='4' ry='4' // style='position: absolute;'> // </ellipse>
var s = board.create('segment', [p1, p2], {strokeWidth: 60}); s.rendNode.setAttribute('stroke-linecap', 'round');
- Default Value:
- [1, 0, 0, 0, 1, 1, 0, 0]
- See:
- JXG.Transformation
- Default Value:
- empty object
- Default Value:
- empty object
- Parameters:
- {String} key
- The attribute's name.
- value
- The new value
- Parameters:
- {JXG.GeometryElement} obj
- The dependent object.
- Parameters:
- {JXG.GeometryElement} obj
- The element that is to be added to the descendants list.
- Returns:
- this
- Parameters:
- {Array} parents
- Array of elements or ids of elements. Alternatively, one can give a list of objects as parameters.
- Returns:
- {JXG.Object} reference to the object itself.
- Examples:
// Movable function graph var A = board.create('point', [1, 0], {name:'A'}), B = board.create('point', [3, 1], {name:'B'}), f = board.create('functiongraph', function(x) { var ax = A.X(), ay = A.Y(), bx = B.X(), by = B.Y(), a = (by - ay) / ( (bx - ax) * (bx - ax) ); return a * (x - ax) * (x - ax) + ay; }, {fixed: false}); f.addParents([A, B]);
- Parameters:
- {Array} function_array
- Array of functions containing potential properties "deps" with elements the function depends on.
- Returns:
- {JXG.Object} reference to the object itself
- Parameters:
- {number} angle
- The degree of the rotation (90 means vertical text).
- See:
- JXG.GeometryElement#rotate
- Parameters:
- {JXG.Ticks} ticks
- Reference to a ticks object which is describing the ticks (color, distance, how many, etc.).
- Returns:
- {String} Id of the ticks object.
- Parameters:
- {JXG.Transformation|Array} transform
- Either one JXG.Transformation or an array of JXG.Transformations.
- Returns:
- {JXG.GeometryElement} Reference to the element.
- Parameters:
- {Object} hash
- Object containing properties 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:
- {JXG.GeometryElement} A reference to the object
- Returns:
- {Array} The coordinates of the enclosing rectangle in a format like the bounding box in JXG.Board#setBoundingBox.
- {Array} similar to JXG.Board#setBoundingBox.
- Returns:
- {JXG.GeometryElement} A reference to the element
- Returns:
- {number} Number of children
- See:
- JXG.SVGRenderer#setGradient
- See:
- #addLabelToElement
- Returns:
- {boolean}
- Parameters:
- {Number} value
- Number to be formatted
- {Number} digits Optional, Default: undefined
- Optional number of digits
- Returns:
- {String|Number} string containing the formatted number according to the locale or the number itself of the formatting is not possible.
- Parameters:
- {Boolean} visible
- Set visibility in case the elements attribute value is 'inherit'. null is allowed.
- Returns:
- {JXG.GeometryElement} Reference to the element
- Returns:
- {Array} An array containing polynomials describing the locus of the current object.
- Parameters:
- {String} key
- The name of the property you are looking for
- Returns:
- The value of the property
- Returns:
- {Object}
- Returns:
- {JXG.Coords} JXG.Coords Place where the text shall be drawn.
- Returns:
- {String}
- Returns:
- {Array}
- Deprecated:
- Use JXG.GeometryElement#getAttribute.
- Returns:
- {Array} containing the snap sizes for x and y direction.
- Returns:
- {JXG.Coords} JXG.Coords Place where the text shall be drawn.
- Returns:
- {String}
- Parameters:
- {Boolean} force
- force snapping independent from what the snaptogrid attribute says
- {Boolean} fromParent
- True if the drag comes from a child element. This is the case if a line through two points is dragged. In this case we do not try to force the points to stay inside of the visible board, but the distance between the two points stays constant.
- Returns:
- {JXG.GeometryElement} Reference to this 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.
- Returns:
- {JXG.GeometryElement} Reference to the element
- Returns:
- {JXG.GeometryElement} Reference to the element
- Returns:
- {JXG.Board}
- Parameters:
- {JXG.GeometryElement} obj
- The dependent object.
- Returns:
- {JXG.Object} reference to the object itself
- Parameters:
- {JXG.GeometryElement} obj
- The element that is to be removed from the descendants list.
- Returns:
- {JXG.Object} reference to the object itself
- Parameters:
- {JXG.Ticks} tick
- Reference to tick object to remove.
- Parameters:
- {Object} attributes
- object
- Returns:
- {Object} The given attributes object with shortcuts expanded.
- Parameters:
- {Boolean} firstArrow
- True if there is an arrow at the start of the arc, false otherwise.
- {Boolean} lastArrow
- True if there is an arrow at the end of the arc, false otherwise.
- object: {key1:value1,key2:value2,...}
- string: 'key:value'
- array: ['key', value]
- Parameters:
- {Object} attributes
- An object with attributes.
- Returns:
- {JXG.GeometryElement} A reference to the element.
- Examples:
// Set attribute 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.setAttribute({ fixed: true, visible: true });
- Parameters:
- {number} dash
- Indicates the new dash style
Sets also the display of the inherits elements. These can be JSXGraph elements or arrays of JSXGraph elements. However, deeper nesting than this is not supported.
- Parameters:
- {Boolean} val
- true: show the element, false: hide the element
- Returns:
- {JXG.GeometryElement} Reference to the element
- Parameters:
- {String} str
- Parameters:
- {String} str
- Parameters:
- {String} str
- Parameters:
- {Array} parents
- Array of elements or ids of elements. Alternatively, one can give a list of objects as parameters.
- Returns:
- {JXG.Object} reference to the object itself.
- Parameters:
- {Number} method
- The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN.
- {Array} coords
- array of translation vector.
- Returns:
- {JXG.GeometryElement} Reference to the element object.
- See:
- JXG.GeometryElement3D#setPosition2D
- Parameters:
- {Number} method
- The type of coordinates used here. Possible values are JXG.COORDS_BY_USER and JXG.COORDS_BY_SCREEN.
- {Array} coords
- coordinates in screen/user units
- {Array} oldcoords
- previous coordinates in screen/user units
- Returns:
- {JXG.GeometryElement} this element
- Deprecated:
- Use JXG.GeometryElement#setAttribute.
- Returns:
- {JXG.GeometryElement} Reference to the element
- Returns:
- {JXG.GeometryElement} Reference to the element
- Returns:
- {JXG.GeometryElement} Reference to the element.
- Returns:
- {JXG.GeometryElement} Reference to the element
- Returns:
- {JXG.GeometryElement} Reference to the element
- The value of the element's attribute 'visible'
- The visibility of a parent element. (Example: label) This overrules the value of the element's attribute value only if this attribute value of the element is 'inherit'.
- being inside of the canvas
This method is called three times for most elements:
- between JXG.GeometryElement#update and JXG.GeometryElement#updateRenderer. In case the value is 'inherit', nothing is done.
- Recursively, called by itself for child elements. Here, 'inherit' is overruled by the parent's value.
- In JXG.GeometryElement#updateRenderer, if the element is outside of the canvas.
- Parameters:
- {Boolean} parent_val
- Visibility of the parent element.
- Returns:
- {JXG.GeometryElement} Reference to the element.
- Returns:
- {Boolean} if locale can be used for number formatting.
- Parameters:
- {Object} o
- A list of changed attributes and their new value.
- {Object} el
- Reference to the element
- Parameters:
- val
- The old value.
- nval
- The new value
- {Object} el
- Reference to the element
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.
- Parameters:
- {Event} e
- The browser's event object.