Members
Own
(static) COORDS_BY_SCREEN : Number
- Description
Constant: screen coordinates in pixel relative to the upper left corner of the div element.
- Type
- Number
- Source
- base/constants.js, line 79
(static) COORDS_BY_USER : Number
- Description
Constant: user coordinates relative to the coordinates system defined by the bounding box.
- Type
- Number
- Source
- base/constants.js, line 72
(static) FileReader
- Description
The FileReader object bundles the file input capabilities of JSXGraph.
- Source
- reader/file.js, line 44
(static) Validator
- Description
Holds all possible attributes and the according validators for geometry elements. A validator is either a function which takes one parameter and returns true, if the value is valid for the property, or it is false if no validator is required.
- Source
- options.js, line 10981
(static) boards : Object
- Description
Store a reference to every board in this central list. This will at some point replace JXG.JSXGraph.boards.
- Type
- Object
- Source
- jxg.js, line 236
(static) elements : Object
- Description
Associative array that keeps track of all constructable elements registered via JXG.registerElement.
- Type
- Object
- Source
- jxg.js, line 249
(static) ieVersion : Number
- Description
Internet Explorer version. Works only for IE > 4.
- Type
- Number
- Deprecated
- Yes
- Source
- utils/env.js, line 412
(static) isBrowser : Boolean
- Description
A document/window environment is available.
- Type
- Boolean
- Default Value
- false
- Source
- utils/env.js, line 141
(static) licenseLogo : String
- Description
JSXGraph logo: base64 data-URL of img/png/screen/jsxgraph-logo_black-square-solid.svg
- Type
- String
- Source
- base/constants.js, line 64
(static) licenseText : String
- Description
Constant: the small gray version indicator in the top left corner of every JSXGraph board (if showCopyright is not set to false on board creation).
- Type
- String
- Source
- base/constants.js, line 55
(private, static) maxScreenCoord
- Description
Upper bound on pixel coordinates. This is used in svg and canvas renderer to avoid limitations on numbers there. 2026: can be enlarged to 2**24-1, the largest integer valiue that browsers do support. Browser implementations support 32bit floating point values.
- Source
- utils/env.js, line 70
(static) palette : Object
- Description
Default color palette. Contains at least color values for
- black
- blue
- green
- purple
- red
- white
- yellow
- Type
- Object
- Default Value
- JXG.paletteWong
- See
- Example
-
var p = board.create('line', [[-1, 1], [2, -3]], {strokeColor: JXG.palette.yellow}); - Source
- utils/color.js, line 1119
(static) paletteWong : Object
- Description
Bang Wong color palette, optimized for various type of color blindness. It contains values for
- 'black'
- 'orange'
- 'skyblue'
- 'bluishgreen'
- 'yellow'
- 'darkblue'
- 'vermillion'
- 'reddishpurple'
As substitutes for standard colors, it contains the following aliases:
- black (= #000000)
- blue (= darkblue)
- green (= bluishgreen)
- purple (= reddishpurple)
- red (= vermillion)
- white (= #ffffff)
See Bang Wong: "Points of view: Color blindness" and https://davidmathlogic.com/colorblind/.
- Type
- Object
- See
- Example
-
var p = board.create('line', [[-1, 1], [2, -3]], {strokeColor: JXG.paletteWong.yellow}); - Source
- utils/color.js, line 1067
(static) readers : Object
(static) version : String
- Description
Constant: the currently used JSXGraph version.
- Type
- String
- Source
- base/constants.js, line 47
Inherited
none
Methods
Own
(static) LMS2rgb(l, m, s) → {Array}
Convert color information from LMS to RGB color space.
Parameters
| Name | Type | Description |
|---|---|---|
l |
Number | |
m |
Number | |
s |
Number |
Returns
Contains the r, g, and b value in this order.
- Type
- Array
Details
- Source
- utils/color.js, line 614
(private, static) _ceil10(value, exp) → {Number}
"Ceil" a number to given number of decimal digits.
Example: JXG._toFixed(3.14159, -2) gives 3.15
Parameters
| Name | Type | Description |
|---|---|---|
value |
Number | Number to be ceiled |
exp |
Number | Number of decimal digits given as negative exponent |
Returns
"Ceiled" number.
- Type
- Number
Details
- Source
- utils/type.js, line 1039
(private, static) _decimalAdjust(type, value, exp) → {Number}
Decimal adjustment of a number. From https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Math/round
Parameters
| Name | Type | Description |
|---|---|---|
type |
String | The type of adjustment. |
value |
Number | The number. |
exp |
Number | The exponent (the 10 logarithm of the adjustment base). |
Returns
The adjusted value.
- Type
- Number
Details
- Source
- utils/type.js, line 979
(private, static) _floor10(value, exp) → {Number}
"Floor" a number to given number of decimal digits.
Example: JXG._toFixed(3.14159, -2) gives 3.14
Parameters
| Name | Type | Description |
|---|---|---|
value |
Number | Number to be floored |
exp |
Number | Number of decimal digits given as negative exponent |
Returns
"Floored" number.
- Type
- Number
Details
- Source
- utils/type.js, line 1025
(private, static) _round10(value, exp) → {Number}
Round a number to given number of decimal digits.
Example: JXG._toFixed(3.14159, -2) gives 3.14
Parameters
| Name | Type | Description |
|---|---|---|
value |
Number | Number to be rounded |
exp |
Number | Number of decimal digits given as negative exponent |
Returns
Rounded number.
- Type
- Number
Details
- Source
- utils/type.js, line 1011
(static) addEvent(obj, type, fn, owner, optionsopt)
Adds an event listener to a DOM element.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
obj |
Object | Reference to a DOM node. |
||
type |
String | The event to catch, without leading 'on', e.g. 'mousemove' instead of 'onmousemove'. |
||
fn |
function | The function to call when the event is triggered. |
||
owner |
Object | The scope in which the event trigger is called. |
||
options |
Object | Boolean |
<optional> |
false
|
This parameter is passed as the third parameter to the method addEventListener. Depending on the data type it is either an options object or the useCapture Boolean. |
Details
- Source
- utils/env.js, line 519
(static) appBox(box, attributes) → {JXG.Board}
Create a JSXGraph div element containing a JSXGraph board inside of a user supplied div.
The styling of the supplied div is up to the user, see the style-tag in the example below for one possibility. The CSS for the inner div, hosting the JSXGraph board, is supplied by the attributes
jxgbox: {
cssStyle: 'width:640px; aspect-ratio:2/1; background-color: white',
cssClass: '',
id: 'jxgbox'
}
i.e. the div's style-attribute and a list of classes (separated by blanks) can be given.
By setting the attribute "clip" to false for selected elements (like sliders and texts), these elements can be positioned outside of the JSXGraph board. For those elements, the setting of the attributes "frozen:true, fixed:true" is recommended to make their position independent from zooming or panning the board coordinates.
However, not all elements will look good if displayed outside of the JSXGraph board - be careful.
Example
// Styling of the outer div
<style>
.container {
display: flex;
align-items: center;
justify-content: center;
width: 800px;
height: 500px;
overflow: hidden;
border: 1px black solid;
border-radius: 10px;
background-color: #eee;
}
</style>
<div id="container" class="container"></div>
<script type="text/javascript">
const board = JXG.appBox('container', {
jxgbox: {
// Styling of the inner div
cssStyle: 'width:640px; aspect-ratio:2/1; background-color: white',
cssClass: '',
id: 'jxgbox'
},
boundingbox: [-5, 5, 5, -5],
axis: true,
showFullScreen: true
});
const point1 = board.create("point", [4, 1], { name: 'A' });
const point2 = board.create("point", [3, -1], {name: 'B'});
const point3 = board.create("point", [6, -1], { clip: false });
var sl = board.create('slider', [[-3, -6], [-1, -6], [-5, 1, 5]], {
clip: false,
frozen: true,
size: 16,
face: '[]',
name: 's'
});
var graph = board.create("functiongraph", ['s.Value() * x^3'], { clip: true });
</script>
Parameters
| Name | Type | Description |
|---|---|---|
box |
String | Object | id of or reference to the HTML element in which the board is painted into a sub-element of type div. |
attributes |
Object | An object that sets some of the board attributes and attributes of the sub-element containing the board. See JXG.Board for a list of available attributes of the board. Most of these attributes can also be set globally via JXG.Options. |
Returns
Reference to the created board.
- Type
- JXG.Board
Details
(static) autoDigits(val) → {Number}
Truncate a number val automatically.
Parameters
| Name | Type | Description |
|---|---|---|
val |
Returns
- Type
- Number
Details
- Source
- utils/type.js, line 1064
(static) autoHighlight(color) → {String}
Determines highlight color to a given color. Done by reducing (or increasing) the opacity.
Parameters
| Name | Type | Description |
|---|---|---|
color |
String | HTML RGBA string containing the HTML color code. |
Returns
Returns a HTML RGBA color string
- Type
- String
Details
- Source
- utils/color.js, line 931
(static) bind(fn, owner) → {function}
Generates a function which calls the function fn in the scope of owner.
Parameters
| Name | Type | Description |
|---|---|---|
fn |
function | Function to call. |
owner |
Object | Scope in which fn is executed. |
Returns
A function with the same signature as fn.
- Type
- function
Details
- Source
- utils/type.js, line 681
(static) board(box, attributes) → {JXG.Board}
Initialize a new board. Alias of JXG.JSXGraph.initBoard.
Examples
var board = JXG.board('jxgbox', {
boundingbox: [-10, 5, 10, -5],
keepaspectratio: false,
axis: true
});
const board = JXG.board('jxgbox', {
boundingbox: [-10, 10, 10, -10],
axis: true,
showCopyright: true,
showFullscreen: true,
showScreenshot: false,
showClearTraces: false,
showInfobox: false,
showNavigation: true,
grid: false,
defaultAxes: {
x: {
withLabel: true,
label: {
position: '95% left',
offset: [-10, 10]
},
lastArrow: {
type: 4,
size: 10
}
},
y: {
withLabel: true,
label: {
position: '0.90fr right',
offset: [6, -6]
},
lastArrow: {
type: 4,
size: 10
}
}
}
});
const board = JXG.board('jxgbox', {
boundingbox: [-5, 5, 5, -5],
intl: {
enabled: false,
locale: 'en-EN'
},
keepaspectratio: true,
axis: true,
defaultAxes: {
x: {
ticks: {
intl: {
enabled: true,
options: {
style: 'unit',
unit: 'kilometer-per-hour',
unitDisplay: 'narrow'
}
}
}
},
y: {
ticks: {
}
}
},
infobox: {
fontSize: 20,
intl: {
enabled: true,
options: {
minimumFractionDigits: 4,
maximumFractionDigits: 5
}
}
}
});
Parameters
| Name | Type | Description |
|---|---|---|
box |
String | Object | id of or reference to the HTML element in which the board is painted. |
attributes |
Object | An object that sets some of the board attributes. See JXG.Board for a list of available attributes of the board. Most of these attributes can also be set globally via JXG.Options. |
Returns
Reference to the created board.
- Type
- JXG.Board
Details
(static) capitalize(str) → {String}
Makes a string lower case except for the first character which will be upper case.
Parameters
| Name | Type | Description |
|---|---|---|
str |
String | Arbitrary string |
Returns
The capitalized string.
- Type
- String
Details
- Source
- utils/type.js, line 1871
(static) clearVisPropOld(el) → {GeometryElement}
Resets visPropOld.
Parameters
| Name | Type | Description |
|---|---|---|
el |
JXG.GeometryElement |
Returns
- Type
- GeometryElement
Details
- Source
- utils/type.js, line 1796
(static) clone(obj) → {Object}
This outputs an object with a base class reference to the given object. This is useful if you need a copy of an e.g. attributes object and want to overwrite some of the attributes without changing the original object.
Parameters
| Name | Type | Description |
|---|---|---|
obj |
Object | Object to be embedded. |
Returns
An object with a base class reference to obj.
- Type
- Object
Details
- Source
- utils/type.js, line 1183
(static) cloneAndCopy(obj, obj2) → {Object}
Embeds an existing object into another one just like #clone and copies the contents of the second object to the new one. Warning: The copied properties of obj2 are just flat copies.
Parameters
| Name | Type | Description |
|---|---|---|
obj |
Object | Object to be copied. |
obj2 |
Object | Object with data that is to be copied to the new one as well. |
Returns
Copy of given object including some new/overwritten data from obj2.
- Type
- Object
Details
- Source
- utils/type.js, line 1198
(static) cmpArrays(a1, a2) → {Boolean}
Compare two arrays.
Parameters
| Name | Type | Description |
|---|---|---|
a1 |
Array | |
a2 |
Array |
Returns
true, if the arrays coefficients are of same type and value.
- Type
- Boolean
Details
- Source
- utils/type.js, line 912
(static) concat(dest, src)
Concat array src to array dest. Uses push instead of JavaScript concat, which is much faster. The array dest is changed in place. Attention: if "dest" is an anonymous array, the correct result is returned from the function.
Parameters
| Name | Type | Description |
|---|---|---|
dest |
Array | |
src |
Array |
Returns
Array
Details
- Source
- utils/type.js, line 2027
(static) contrast(hexColor, darkColoropt, lightColoropt, thresholdopt) → {String}
Calculate whether a light or a dark color is needed as a contrast. Especially useful to determine whether white or black font goes better with a given background color.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
hexColor |
String | HEX value of color. |
||
darkColor |
String |
<optional> |
"#000000"
|
HEX string for a dark color. |
lightColor |
String |
<optional> |
"#ffffff"
|
HEX string for a light color. |
threshold |
Number |
<optional> |
8
|
Returns
Returns darkColor or lightColor.
- Type
- String
Details
- Source
- utils/color.js, line 959
(static) coordsArrayToMatrix(coords, split) → {Array}
Converts an array of JXG.Coords objects into a coordinate matrix.
Parameters
| Name | Type | Description |
|---|---|---|
coords |
Array | |
split |
Boolean |
Returns
- Type
- Array
Details
- Source
- utils/type.js, line 885
(static) copyAttributes(attributes, options, s) → {Object}
Generates an attributes object that is filled with default values from the Options object and overwritten by the user specified attributes.
Parameters
| Name | Type | Description |
|---|---|---|
attributes |
Object | user specified attributes |
options |
Object | default options |
s |
String | variable number of strings, e.g. 'slider', subtype 'point1'. Must be provided in lower case! |
Returns
The resulting attributes object
- Type
- Object
Details
- Source
- utils/type.js, line 1500
(private, static) copyMethodMap(objectClass, extensionopt)
Create a copy of methodMap in "objectClass.prototype" and optional extend it. If objectClass.prototype.methodMap does not exist, it will be initialized.
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.
Parameters
| Name | Type | Attributes | Description |
|---|---|---|---|
objectClass |
Object | ||
extension |
Object |
<optional> |
Details
- Source
- utils/type.js, line 1638
(private, static) copyPrototypeMethods(subObject, superObject, constructorName)
Copy all prototype methods from object "superObject" to object "subObject". The constructor of superObject will be available in subObject as subObject.constructor[constructorName].
Parameters
| Name | Type | Description |
|---|---|---|
subObject |
Object | A JavaScript object which receives new methods. |
superObject |
Object | A JavaScript object which lends its prototype methods to subObject |
constructorName |
String | Under this name the constructor of superObj will be available in subObject. |
Details
- Source
- utils/type.js, line 1611
(static) createEvalFunction(board, param, n) → {function}
Convert a String, a number or a function into a function. This method is used in Transformation.js
Parameters
| Name | Type | Description |
|---|---|---|
board |
JXG.Board | Reference to a JSXGraph board. It is required to resolve dependencies given by a JessieCode string, thus it must be a valid reference only in case one of the param values is of type string. |
param |
Array | An array containing strings, numbers, or functions. |
n |
Number | Length of |
Returns
A function taking one parameter k which specifies the index of the param element to evaluate.
- Type
- function
Details
- Source
- utils/type.js, line 432
(static) createFunction(term, board, variableName, evalGeonextopt) → {function}
Convert a String, number or function into a function.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
term |
String | Number | function | A variable of type string, function or number. |
||
board |
JXG.Board | Reference to a JSXGraph board. It is required to resolve dependencies given by a JessieCode/GEONEXT string, thus it must be a valid reference only in case one of the param values is of type string. |
||
variableName |
String | Only required if function is supplied as JessieCode string or evalGeonext is set to true. Describes the variable name of the variable in a JessieCode/GEONEXT string given as term. |
||
evalGeonext |
Boolean |
<optional> |
false
|
Obsolete and ignored! Set this true if term should be treated as a GEONEXT string. |
Returns
A function evaluating the value given by term or null if term is not of type string, function or number.
- Type
- function
Details
- Source
- utils/type.js, line 464
(static) css2js(cssString) → {Array}
Converts string containing CSS properties into array with key-value pair objects.
Example
"color:blue; background-color:yellow" is converted to
[{'color': 'blue'}, {'backgroundColor': 'yellow'}]
Parameters
| Name | Type | Description |
|---|---|---|
cssString |
String | String containing CSS properties |
Returns
Array of CSS key-value pairs
- Type
- Array
Details
- Source
- utils/type.js, line 378
(static) cssParse(cssString) → {Object}
Converts a given CSS style string into a JavaScript object. Uses JSON.parse.
Has problems with CSS expressions containing blanks, like
background: #aaaaaa url("../jsxgraph/img/favicon.png").
Parameters
| Name | Type | Description |
|---|---|---|
cssString |
String | String containing CSS styles. |
Returns
Object containing CSS styles.
- Type
- Object
Details
- Deprecated
- Yes
- See
-
- JXG#css2js
- Source
- utils/type.js, line 354
(static) cssStringify(styles) → {String}
Converts a given object into a CSS style string.
Parameters
| Name | Type | Description |
|---|---|---|
styles |
Object | Object containing CSS styles. |
Returns
String containing CSS styles.
- Type
- String
Details
- Source
- utils/type.js, line 405
(static) darkenColor(color, percent) → {String}
Darkens the color by the specified factor.
Parameters
| Name | Type | Description |
|---|---|---|
color |
String | |
percent |
Number |
Returns
- Type
- String
Details
- See
- Source
- utils/color.js, line 899
(static) debug(s)
Add something to the debug log. If available a JavaScript debug console is used. Otherwise we're looking for a HTML div with id "debug". If this doesn't exist, too, the output is omitted.
Parameters
| Name | Type | Description |
|---|---|---|
s |
An arbitrary number of parameters. |
Details
(static) debugInt(s)
Add something to the debug log. If available a JavaScript debug console is used. Otherwise we're looking for a HTML div with id "debug". If this doesn't exist, too, the output is omitted.
Parameters
| Name | Type | Description |
|---|---|---|
s |
An arbitrary number of parameters. |
Details
(static) debugLine(s)
Add something to the debug log. If available a JavaScript debug console is used. Otherwise we're looking for a HTML div with id "debug". If this doesn't exist, too, the output is omitted. This method adds a line of the stack trace (if available).
Parameters
| Name | Type | Description |
|---|---|---|
s |
An arbitrary number of parameters. |
Details
(static) debugWST(s)
Add something to the debug log. If available a JavaScript debug console is used. Otherwise we're looking for a HTML div with id "debug". If this doesn't exist, too, the output is omitted. This method adds a stack trace (if available).
Parameters
| Name | Type | Description |
|---|---|---|
s |
An arbitrary number of parameters. |
Details
(static) deepCopy(obj, obj2, toLoweropt) → {Object}
Creates a deep copy of an existing object, i.e. arrays or sub-objects are copied component resp. element-wise instead of just copying the reference. If a second object is supplied, the two objects are merged into one object. The properties of the second object have priority.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
obj |
Object | This object will be copied. |
||
obj2 |
Object | This object will merged into the newly created object |
||
toLower |
Boolean |
<optional> |
false
|
If true the keys are convert to lower case. This is needed for visProp, see JXG#copyAttributes |
Returns
copy of obj or merge of obj and obj2.
- Type
- Object
Details
- Source
- utils/type.js, line 1324
(static) def(v, d)
Handle default parameters.
Parameters
| Name | Type | Description |
|---|---|---|
v |
Given value |
|
d |
Default value |
Returns
d, if v is undefined or null.
Details
- Source
- utils/type.js, line 315
(static) deprecated(what, replacementopt)
This method issues a warning to the developer that the given function is deprecated and, if available, offers an alternative to the deprecated function.
Parameters
| Name | Type | Attributes | Description |
|---|---|---|---|
what |
String | Describes the function that is deprecated |
|
replacement |
String |
<optional> |
The replacement that should be used instead. |
Details
(static) eliminateDuplicates(a) → {Array}
Eliminates duplicate entries in an array consisting of numbers and strings.
Parameters
| Name | Type | Description |
|---|---|---|
a |
Array | An array of numbers and/or strings. |
Returns
The array with duplicate entries eliminated.
- Type
- Array
Details
- Source
- utils/type.js, line 742
(static) escapeHTML(str) → {String}
Replaces all occurences of & by &, > by >, and < by <.
Parameters
| Name | Type | Description |
|---|---|---|
str |
String |
Returns
- Type
- String
Details
- Source
- utils/type.js, line 1846
(static) evalSlider(s) → {*}
If s is a slider, it returns the sliders value, otherwise it just returns the given value.
Parameters
| Name | Type | Description |
|---|---|---|
s |
* |
Returns
s.Value() if s is an element of type slider, s otherwise
- Type
- *
Details
- Source
- utils/type.js, line 2067
(static) evaluate(val)
If val is a function, it will be evaluated without giving any parameters, else the input value
is just returned.
Parameters
| Name | Type | Description |
|---|---|---|
val |
Could be anything. Preferably a number or a function. If it is an array, evaluate() recurses into the elements. |
Returns
If val is a function, it is evaluated and the result is returned. Otherwise val is returned.
Details
- Source
- utils/type.js, line 694
(static) exists(v, checkEmptyStringopt) → {Boolean}
Checks if a given variable is neither undefined nor null. You should not use this together with global variables!
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
A variable of any type. |
|||
checkEmptyString |
Boolean |
<optional> |
false
|
If set to true, it is also checked whether v is not equal to ''. |
Returns
True, if v is neither undefined nor null.
- Type
- Boolean
Details
- Source
- utils/type.js, line 285
(private, static) extendInstanceMethodMap(object, extensionopt, extensionValueopt)
Copy methodMap of "object.prototype" to objects instance and optional extend it. If extension is of type String and extensionValue is defined, a key-value-pair is added.
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.
Parameters
| Name | Type | Attributes | Description |
|---|---|---|---|
object |
Object | ||
extension |
Object | String |
<optional> |
|
extensionValue |
String |
<optional> |
Details
- Source
- utils/type.js, line 1658
(static) filterElements(list, filter) → {Array}
Filter an array of elements.
Parameters
| Name | Type | Description |
|---|---|---|
list |
Array | |
filter |
Object | function |
Returns
- Type
- Array
Details
- Source
- utils/type.js, line 1901
(static) getBoardByContainerId(s) → {Object}
s may be the string containing the id of an HTML tag that hosts a JSXGraph board. This function returns the reference to the board.
Parameters
| Name | Type | Description |
|---|---|---|
s |
String | String of an HTML tag that hosts a JSXGraph board |
Returns
Reference to the board or null.
- Type
- Object
Details
(static) getCSSTransform(cPos, obj) → {Array}
Correct position of upper left corner in case of a CSS transformation. Here, only translations are extracted. All scaling transformations are corrected in JXG.Board#getMousePosition.
Parameters
| Name | Type | Description |
|---|---|---|
cPos |
Array | Previously determined position |
obj |
Object | A DOM element |
Returns
The corrected position.
- Type
- Array
Details
- Source
- utils/env.js, line 772
(static) getCSSTransformMatrix() → {Array}
Scaling CSS transformations applied to the div element containing the JSXGraph constructions are determined. In IE prior to 9, 'rotate', 'skew', 'skewX', 'skewY' are not supported.
Returns
3x3 transformation matrix without translation part. See JXG.Board#updateCSSTransforms.
- Type
- Array
Details
- Source
- utils/env.js, line 846
(private, static) getCloneObject(el)
Create a stripped down version of a JSXGraph element for cloning to the background. Used in {JXG.GeometryElement#cloneToBackground} for creating traces.
Parameters
| Name | Type | Description |
|---|---|---|
el |
JXG.GeometryElement | Element to be cloned |
Returns
Object Cloned element
Details
- Source
- utils/type.js, line 1681
(static) getDimensions(elementId) → {Object}
Reads the width and height of an HTML element.
Parameters
| Name | Type | Description |
|---|---|---|
elementId |
String | Object | id of or reference to an HTML DOM node. |
Returns
An object with the two properties width and height.
- Type
- Object
Details
- Source
- utils/env.js, line 436
(static) getNumberOfTouchPoints(evt) → {Number}
Determines the number of touch points in a touch event. For other events, -1 is returned.
Parameters
| Name | Type | Description |
|---|---|---|
evt |
Event |
Returns
- Type
- Number
Details
- Source
- utils/env.js, line 107
(static) getOffset(obj) → {Array}
Calculates recursively the offset of the DOM element in which the board is stored.
Parameters
| Name | Type | Description |
|---|---|---|
obj |
Object | A DOM element |
Returns
An array with the elements left and top offset.
- Type
- Array
Details
- Source
- utils/env.js, line 672
(static) getPosition(eopt, indexopt, docopt) → {Array}
Cross browser mouse / pointer / touch coordinates retrieval relative to the documents's top left corner. This method might be a bit outdated today, since pointer events and clientX/Y are omnipresent.
Parameters
| Name | Type | Attributes | Description |
|---|---|---|---|
e |
Object |
<optional> |
The browsers event object. If omitted, |
index |
Number |
<optional> |
If |
doc |
Object |
<optional> |
The document object. |
Returns
Contains the position as x,y-coordinates in the first resp. second component.
- Type
- Array
Details
- Source
- utils/env.js, line 623
(static) getProp(el, css) → {number}
Reads css style sheets of a given element. This method is a getStyle wrapper and
defaults the read value to 0 if it can't be parsed as an integer value.
Parameters
| Name | Type | Description |
|---|---|---|
el |
DOMElement | |
css |
string |
Returns
- Type
- number
Details
- Source
- utils/env.js, line 758
(static) getRef(board, s) → {Object}
s may be a string containing the name or id of an element or even a reference to the element itself. This function returns a reference to the element. Search order: id, name.
Parameters
| Name | Type | Description |
|---|---|---|
board |
JXG.Board | Reference to the board the element belongs to. |
s |
String | String or reference to a JSXGraph element. |
Returns
Reference to the object given in parameter object
- Type
- Object
Details
- Deprecated
- Use JXG.Board#select
- Source
- jxg.js, line 304
(static) getReference()
This is just a shortcut to JXG.getRef.
Details
- Deprecated
- Use JXG.Board#select.
- Source
- jxg.js, line 313
(static) getStyle(obj, stylename)
Access CSS style sheets.
Parameters
| Name | Type | Description |
|---|---|---|
obj |
Object | A DOM element |
stylename |
String | The CSS property to read. |
Returns
The value of the CSS property and undefined if it is not set.
Details
- Source
- utils/env.js, line 728
(static) hex2rgb(hex) → {String}
Converts a valid HTML/CSS color string from the '#rrggbb' format into the 'rgb(r, g, b)' format.
Parameters
| Name | Type | Description |
|---|---|---|
hex |
String | A valid HTML or CSS styled color value, e.g. '#12ab21', '#abc', or 'black' |
Returns
A 'rgb(r, g, b)' formatted string
- Type
- String
Details
- Deprecated
- Use JXG#rgb2css instead.
- Source
- utils/color.js, line 396
(static) hsv2hsl(H, S, V) → {Array}
Converts HSV color to HSL color. From https://en.wikipedia.org/wiki/HSL_and_HSV.
Parameters
| Name | Type | Description |
|---|---|---|
H |
Number | value between 0 and 360 |
S |
Number | value between 0.0 (shade of gray) to 1.0 (pure color) |
V |
Number | value between 0.0 (black) to 1.0 (white) |
Returns
Contains the numbers h, s, and l value in this order.
- Type
- Array
Details
- Source
- utils/color.js, line 409
(static) hsv2rgb(H, S, V) → {String}
Converts HSV color to RGB color. Based on C Code in "Computer Graphics -- Principles and Practice," Foley et al, 1996, p. 593. See also https://www.had2know.org/technology/hsv-rgb-conversion-formula-calculator.html
Parameters
| Name | Type | Description |
|---|---|---|
H |
Number | value between 0 and 360 |
S |
Number | value between 0.0 (shade of gray) to 1.0 (pure color) |
V |
Number | value between 0.0 (black) to 1.0 (white) |
Returns
RGB color string
- Type
- String
Details
- Source
- utils/color.js, line 426
(static) indexOf(array, value, subopt) → {Number}
Search an array for a given value.
Parameters
| Name | Type | Attributes | Description |
|---|---|---|---|
array |
Array | ||
value |
|||
sub |
String |
<optional> |
Use this property if the elements of the array are objects. |
Returns
The index of the first appearance of the given value, or
-1 if the value was not found.
- Type
- Number
Details
- Source
- utils/type.js, line 720
(static) isAndroid() → {Boolean}
Detects if the user is using an Android powered device.
Returns
- Type
- Boolean
Details
- Deprecated
- Yes
- Source
- utils/env.js, line 282
(static) isApple() → {Boolean}
Detects if the user is using a Apple iPad / iPhone.
Returns
- Type
- Boolean
Details
- Deprecated
- Yes
- Source
- utils/env.js, line 303
(static) isArray(v) → {Boolean}
Checks if a given variable references an array.
Parameters
| Name | Type | Description |
|---|---|---|
v |
A variable of any type. |
Returns
True, if v is of type array.
- Type
- Boolean
Details
- Source
- utils/type.js, line 142
(static) isBoard(v) → {Boolean}
Checks if the given object is an JSXGraph board.
Parameters
| Name | Type | Description |
|---|---|---|
v |
Object |
Returns
- Type
- Boolean
Details
- Source
- utils/type.js, line 55
(static) isDesktop() → {boolean}
Detects if the user is using a desktop device, see https://stackoverflow.com/a/61073480.
Returns
- Type
- boolean
Details
- Deprecated
- Yes
- Source
- utils/env.js, line 380
(static) isDocumentOrFragment(v)
Tests if the input variable is a DOM Document or DocumentFragment node
Parameters
| Name | Type | Description |
|---|---|---|
v |
A variable of any type |
Details
- Source
- utils/type.js, line 171
(static) isEmpty(v) → {boolean}
Checks if v is an empty object or empty.
Parameters
| Name | Type | Description |
|---|---|---|
v |
Object | Array |
Returns
True, if v is an empty object or array.
- Type
- boolean
Details
- Source
- utils/type.js, line 274
(static) isFirefoxOS() → {Boolean}
Detects if the user is using a firefoxOS powered device.
Returns
- Type
- Boolean
Details
- Deprecated
- Yes
- Source
- utils/env.js, line 364
(static) isFirstTouch(evt) → {boolean}
Checks whether an mouse, pointer or touch event evt is the first event of a multitouch event. Attention: When two or more pointer device types are being used concurrently, it is only checked whether the passed event is the first one of its type!
Parameters
| Name | Type | Description |
|---|---|---|
evt |
Event |
Returns
- Type
- boolean
Details
- Source
- utils/env.js, line 124
(static) isFunction(v) → {Boolean}
Checks if a given variable references a function.
Parameters
| Name | Type | Description |
|---|---|---|
v |
A variable of any type. |
Returns
True, if v is a function.
- Type
- Boolean
Details
- Source
- utils/type.js, line 133
(static) isGroup(board, s) → {Boolean}
Checks if the given string is a group id within the given board.
Parameters
| Name | Type | Description |
|---|---|---|
board |
JXG.Board | |
s |
String |
Returns
- Type
- Boolean
Details
- Source
- utils/type.js, line 92
(static) isId(board, s) → {Boolean}
Checks if the given string is an id within the given board.
Parameters
| Name | Type | Description |
|---|---|---|
board |
JXG.Board | |
s |
String |
Returns
- Type
- Boolean
Details
- Source
- utils/type.js, line 72
(static) isInArray(arr, val) → {Boolean}
Checks if an array contains an element equal to val but does not check the type!
Parameters
| Name | Type | Description |
|---|---|---|
arr |
Array | |
val |
Returns
- Type
- Boolean
Details
- Source
- utils/type.js, line 875
(static) isInObject(obj, val) → {Boolean}
Checks if an object contains a key, whose value equals to val.
Parameters
| Name | Type | Description |
|---|---|---|
obj |
Object | |
val |
Returns
- Type
- Boolean
Details
- Source
- utils/type.js, line 1827
(static) isMetroApp() → {Boolean}
Returns true if the run inside a Windows 8 "Metro" App.
Returns
- Type
- Boolean
Details
- Deprecated
- Yes
- Source
- utils/env.js, line 337
(static) isMobile() → {boolean}
Detects if the user is using a mobile device, see https://stackoverflow.com/questions/25542814/html5-detecting-if-youre-on-mobile-or-pc-with-javascript.
Returns
- Type
- boolean
Details
- Deprecated
- Yes
- Source
- utils/env.js, line 402
(static) isMouseEvent(evt) → {Boolean}
Determines whether evt is neither a touch event nor a pointer event.
Parameters
| Name | Type | Description |
|---|---|---|
evt |
Event |
Returns
- Type
- Boolean
Details
- Source
- utils/env.js, line 97
(static) isMozilla() → {Boolean}
Detects if the user is using a Mozilla browser
Returns
- Type
- Boolean
Details
- Deprecated
- Yes
- Source
- utils/env.js, line 351
(static) isName(board, s) → {Boolean}
Checks if the given string is a name within the given board.
Parameters
| Name | Type | Description |
|---|---|---|
board |
JXG.Board | |
s |
String |
Returns
- Type
- Boolean
Details
- Source
- utils/type.js, line 82
(static) isNode() → {Boolean}
True, if run inside a node.js environment.
Returns
- Type
- Boolean
Details
- Source
- utils/env.js, line 221
(static) isNumber(v, acceptStringNumberopt, acceptNaNopt) → {Boolean}
Checks if the value of a given variable is of type number.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
v |
A variable of any type. |
|||
acceptStringNumber |
Boolean |
<optional> |
false
|
If set to true, the function returns true for e.g. v='3.1415'. |
acceptNaN |
Boolean |
<optional> |
true
|
If set to false, the function returns false for v=NaN. |
Returns
True, if v is of type number.
- Type
- Boolean
Details
- Source
- utils/type.js, line 112
(static) isObject(v)
Tests if the input variable is an Object
Parameters
| Name | Type | Description |
|---|---|---|
v |
Details
- Source
- utils/type.js, line 163
(static) isPoint(v) → {Boolean}
Checks if a given variable is a reference of a JSXGraph Point element.
Parameters
| Name | Type | Description |
|---|---|---|
v |
A variable of any type. |
Returns
True, if v is of type JXG.Point.
- Type
- Boolean
Details
- Source
- utils/type.js, line 183
(static) isPoint3D(v) → {Boolean}
Checks if a given variable is a reference of a JSXGraph Point3D element.
Parameters
| Name | Type | Description |
|---|---|---|
v |
A variable of any type. |
Returns
True, if v is of type JXG.Point3D.
- Type
- Boolean
Details
- Source
- utils/type.js, line 196
(static) isPointType(board, v) → {Boolean}
Checks if a given variable is a reference of a JSXGraph Point element or an array of length at least two or a function returning an array of length two or three.
Parameters
| Name | Type | Description |
|---|---|---|
board |
JXG.Board | |
v |
A variable of any type. |
Returns
True, if v is of type JXG.Point.
- Type
- Boolean
Details
- Source
- utils/type.js, line 211
(static) isPointType3D(board, v) → {Boolean}
Checks if a given variable is a reference of a JSXGraph Point3D element or an array of length three or a function returning an array of length three.
Parameters
| Name | Type | Description |
|---|---|---|
board |
JXG.Board | |
v |
A variable of any type. |
Returns
True, if v is of type JXG.Point3D or an array of length at least 3, or a function returning such an array.
- Type
- Boolean
Details
- Source
- utils/type.js, line 235
(static) isPointerEvent(evt) → {Boolean}
Determines whether evt is a pointer event.
Parameters
| Name | Type | Description |
|---|---|---|
evt |
Event |
Returns
- Type
- Boolean
Details
- Source
- utils/env.js, line 88
(static) isString(v) → {Boolean}
Checks if the value of a given variable is of type string.
Parameters
| Name | Type | Description |
|---|---|---|
v |
A variable of any type. |
Returns
True, if v is of type string.
- Type
- Boolean
Details
- Source
- utils/type.js, line 101
(static) isTouchDevice() → {Boolean}
Determine if the current browser supports touch events
Returns
True, if the browser supports touch events.
- Type
- Boolean
Details
- Source
- utils/env.js, line 273
(static) isTouchEvent(evt) → {Boolean}
Determines whether evt is a touch event.
Parameters
| Name | Type | Description |
|---|---|---|
evt |
Event |
Returns
- Type
- Boolean
Details
- Source
- utils/env.js, line 79
(static) isTransformationOrArray(v) → {Boolean}
Checks if a given variable is a reference of a JSXGraph transformation element or an array of JSXGraph transformation elements.
Parameters
| Name | Type | Description |
|---|---|---|
v |
A variable of any type. |
Returns
True, if v is of type JXG.Transformation.
- Type
- Boolean
Details
- Source
- utils/type.js, line 257
(static) isWebWorker() → {Boolean}
True if run inside a webworker environment.
Returns
- Type
- Boolean
Details
- Source
- utils/env.js, line 245
(static) isWebkitAndroid() → {Boolean}
Detects if the user is using the default Webkit browser on an Android powered device.
Returns
- Type
- Boolean
Details
- Deprecated
- Yes
- Source
- utils/env.js, line 294
(static) isWebkitApple() → {Boolean}
Detects if the user is using Safari on an Apple device. See https://evilmartians.com/chronicles/how-to-detect-safari-and-ios-versions-with-ease (2025)
Returns
- Type
- Boolean
Details
- Deprecated
- Yes
- Source
- utils/env.js, line 317
(static) keys(object, onlyOwn) → {Array}
Extracts the keys of a given object.
Parameters
| Name | Type | Description |
|---|---|---|
object |
The object the keys are to be extracted |
|
onlyOwn |
If true, hasOwnProperty() is used to verify that only keys are collected the object owns itself and not some other object in the prototype chain. |
Returns
All keys of the given object.
- Type
- Array
Details
- Source
- utils/type.js, line 1156
(static) keysToLowerCase(obj)
Convert an object to a new object containing only lower case properties.
Example
var attr = JXG.keysToLowerCase({radiusPoint: {visible: false}});
// return {radiuspoint: {visible: false}}
Parameters
| Name | Type | Description |
|---|---|---|
obj |
Object |
Returns
Object
Details
- Source
- utils/type.js, line 1463
(static) lightenColor(color, percent) → {String}
Lightens the color by the specified factor.
Parameters
| Name | Type | Description |
|---|---|---|
color |
String | |
percent |
Number |
Returns
- Type
- String
Details
- See
- Source
- utils/color.js, line 887
(static) merge(obj1, obj2) → {Object}
Recursively merges obj2 into obj1 in-place. Contrary to JXG#deepCopy this won't create a new object but instead will overwrite obj1.
In contrast to method JXG.mergeAttr, merge recurses into any kind of object, e.g. DOM object and JSXGraph objects. So, please be careful.
Example
JXG.Options = JXG.merge(JXG.Options, {
board: {
showNavigation: false,
showInfobox: true
},
point: {
face: 'o',
size: 4,
fillColor: '#eeeeee',
highlightFillColor: '#eeeeee',
strokeColor: 'white',
highlightStrokeColor: 'white',
showInfobox: 'inherit'
}
});
Parameters
| Name | Type | Description |
|---|---|---|
obj1 |
Object | |
obj2 |
Object |
Returns
- Type
- Object
Details
- See
- Source
- utils/type.js, line 1274
(static) mergeAttr(attr, special, toLoweropt, ignoreUndefinedSpecialsopt)
In-place (deep) merging of attributes. Allows attributes like {shadow: {enabled: true...}}
In contrast to method JXG.merge, mergeAttr does not recurse into DOM objects and JSXGraph objects. Instead handles (pointers) to these objects are used.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
attr |
Object | Object with attributes - usually containing default options - that will be changed in-place. |
||
special |
Object | Special option values which overwrite (recursively) the default options |
||
toLower |
Boolean |
<optional> |
true
|
If true the keys are converted to lower case. |
ignoreUndefinedSpecials |
Boolean |
<optional> |
false
|
If true the values in special that are undefined are not used. |
Details
- See
- Source
- utils/type.js, line 1404
(static) mixColor(color1, color2, percentopt) → {String}
Mix two colors together in variable proportion. Opacity is NOT included in the calculations.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
color1 |
String | |||
color2 |
String | |||
percent |
Number |
<optional> |
0.5
|
Balance point in percent. |
Returns
- Type
- String
Details
- Source
- utils/color.js, line 910
(static) normalizePointFace(s) → {String}
All point faces can be defined with more than one name, e.g. a cross faced point can be given by face equal to 'cross' or equal to 'x'. This method maps all possible values to fixed ones to simplify if- and switch-clauses regarding point faces. The translation table is as follows:
| Input | Output |
|---|---|
| cross | x |
| circle | o |
| square, [] | [] |
| plus | + |
| minus | - |
| divide | | | |
| diamond | <> |
| diamond2 | <> (bigger) |
| triangleup | ^, a, A |
| triangledown | v |
| triangleleft | < |
| triangleright | > |
Parameters
| Name | Type | Description |
|---|---|---|
s |
String | A string which should determine a valid point face. |
Returns
Returns a normalized string or undefined if the given string is not a valid point face.
- Type
- String
Details
- Source
- options.js, line 11125
(static) parseNumber(v, percentOfWhat, convertPx) → {String|Number}
Convert value v. If v has the form
- 'x%': return floating point number x * percentOfWhat * 0.01
- 'xfr': return floating point number x * percentOfWhat
- 'xpx': return x * convertPx or convertPx(x) or x
- x or 'x': return floating point number x
Parameters
| Name | Type | Description |
|---|---|---|
v |
String | Number | |
percentOfWhat |
Number | |
convertPx |
function | Number | * |
Returns
- Type
- String | Number
Details
- Source
- utils/type.js, line 1093
(static) parsePosition(str) → {Obj}
Parse a string for label positioning of the form 'left pos' or 'pos right'
and return e.g.
{ side: 'left', pos: 'pos' }.
Parameters
| Name | Type | Description |
|---|---|---|
str |
String |
Returns
{ side, pos }
- Type
- Obj
Details
- Source
- utils/type.js, line 1126
(static) providePoints(board, parents, attributes, attrClass, attrArray) → {Array}
Test if array parents contains existing points. If instead parents contains coordinate arrays or
function returning coordinate arrays free points with these coordinates are created.
Handling of attributes:
For points that will be created here, attributes can be supplied. For this, there are two cases:
- If array
attrArrayis not empty: paramattributesis merged withboard.options.attrClass.attrArray[j]with priority for values inattributes. Here,jis the corresponding position in arrayattrArrayof the coordinate array inparents(or the last one).
Examples
attr = Type.copyAttributes(attributes, board.options, 'semicircle');
points = Type.providePoints(board, parents, attr, 'point', ['radiusPoint', 'anglePoint']);
2. If array `attrArray` is empty: `attributes.attrClass` is merged with `board.options.attrClass`.
parents = Type.providePoints(board, parents, attributes, 'point');
points = Type.providePoints(board, parents, attributes, "polygon", ["vertices"]);
Parameters
| Name | Type | Description |
|---|---|---|
board |
JXG.Board | Board object |
parents |
Array | Array containing parent elements for a new object. This array may contain
In the last three cases a new point will be created. |
attributes |
Object | Object containing attributes for newly created points. |
attrClass |
String | Main attribute class of newly created points, see JXG#copyAttributes |
attrArray |
Array | List of subtype attributes for the newly created points. The list of subtypes is mapped to the list of new points. |
Returns
List of newly created JXG.Point elements or false if not all returned elements are points.
- Type
- Array
Details
- Source
- utils/type.js, line 540
(static) providePoints3D(view, parents, attrClass, attrArray) → {Array}
Test if the parents array contains existing points. If instead parents contains coordinate arrays or function returning coordinate arrays free points with these coordinates are created.
Parameters
| Name | Type | Description |
|---|---|---|
view |
JXG.View3D | View3D object |
parents |
Array | Array containing parent elements for a new object. This array may contain
In the last three cases a new 3D point will be created. |
attrClass |
String | Main attribute class of newly created 3D points, see JXG#copyAttributes |
attrArray |
Array | List of subtype attributes for the newly created 3D points. The list of subtypes is mapped to the list of new 3D points. |
Returns
List of newly created JXG.Point3D elements or false if not all returned elements are 3D points.
- Type
- Array
Details
- Source
- utils/type.js, line 613
(static) registerElement(element, creator)
This registers a new construction element to JSXGraph for the construction via the JXG.Board.create interface.
Parameters
| Name | Type | Description |
|---|---|---|
element |
String | The elements name. This is case-insensitive, existing elements with the same name will be overwritten. |
creator |
function | A reference to a function taking three parameters: First the board, the element is
to be created on, a parent element array, and an attributes object. See JXG.createPoint or any other
|
Details
(static) registerReader(reader, ext)
Register a file reader.
Parameters
| Name | Type | Description |
|---|---|---|
reader |
function | A file reader. This object has to provide two methods: |
ext |
Array |
Details
(static) removeAllEvents(obj, type, owner)
Removes all events of the given type from a given DOM node; Use with caution and do not use it on a container div of a JXG.Board because this might corrupt the event handling system.
Parameters
| Name | Type | Description |
|---|---|---|
obj |
Object | Reference to a DOM node. |
type |
String | The event to catch, without leading 'on', e.g. 'mousemove' instead of 'onmousemove'. |
owner |
Object | The scope in which the event trigger is called. |
Details
- Source
- utils/env.js, line 599
(static) removeElementFromArray(ar, el) → {Array}
Removes an element from the given array
Parameters
| Name | Type | Description |
|---|---|---|
ar |
Array | |
el |
Returns
- Type
- Array
Details
- Source
- utils/type.js, line 943
(static) removeEvent(obj, type, fn, owner)
Removes an event listener from a DOM element.
Parameters
| Name | Type | Description |
|---|---|---|
obj |
Object | Reference to a DOM node. |
type |
String | The event to catch, without leading 'on', e.g. 'mousemove' instead of 'onmousemove'. |
fn |
function | The function to call when the event is triggered. |
owner |
Object | The scope in which the event trigger is called. |
Details
- Source
- utils/env.js, line 550
(static) rgb2LMS(color, ag, ab) → {Array}
Converts a color from the RGB color space into the LMS space. Input can be any valid HTML/CSS color definition.
Parameters
| Name | Type | Description |
|---|---|---|
color |
String | Array | Number | A valid HTML or CSS styled color value, e.g. '#12ab21', '#abc', 'black' or 'rgb(12, 132, 233)'. This can also be an array containing three color values either from 0.0 to 1.0 or from 0 to 255. They will be interpreted as red, green, and blue values. In case this is a number this method expects the parameters ag and ab. |
ag |
Number | |
ab |
Number |
Returns
Contains the l, m, and s value in this order.
- Type
- Array
Details
- Source
- utils/color.js, line 569
(static) rgb2bw(color) → {String}
Decolorizes the given color.
Parameters
| Name | Type | Description |
|---|---|---|
color |
String | HTML string containing the HTML color code. |
Returns
Returns a HTML color string
- Type
- String
Details
- Source
- utils/color.js, line 722
(static) rgb2cb(color, deficiency) → {String}
Converts a color into how a colorblind human approximately would see it.
Parameters
| Name | Type | Description |
|---|---|---|
color |
String | HTML string containing the HTML color code. |
deficiency |
String | The type of color blindness. Possible options are protanopia, deuteranopi>, and tritanopia. |
Returns
Returns a HTML color string
- Type
- String
Details
- Source
- utils/color.js, line 752
(static) rgb2css(color, ag, ab) → {String}
Converts a valid HTML/CSS color string into a string of the 'rgb(r, g, b)' format.
Parameters
| Name | Type | Description |
|---|---|---|
color |
String | Array | Number | A valid HTML or CSS styled color value, e.g. '#12ab21', '#abc', 'black' or 'rgb(12, 132, 233)'. This can also be an array containing three color values either from 0.0 to 1.0 or from 0 to 255. They will be interpreted as red, green, and blue values. In case this is a number this method expects the parameters ag and ab. |
ag |
Number | |
ab |
Number |
Returns
A 'rgb(r, g, b)' formatted string
- Type
- String
Details
- Source
- utils/color.js, line 346
(static) rgb2hex(color, ag, ab) → {String}
Converts a valid HTML/CSS color string into a HTML rgb string.
Parameters
| Name | Type | Description |
|---|---|---|
color |
String | Array | Number | A valid HTML or CSS styled color value, e.g. '#12ab21', '#abc', 'black' or 'rgb(12, 132, 233)'. This can also be an array containing three color values either from 0.0 to 1.0 or from 0 to 255. They will be interpreted as red, green, and blue values. In case this is a number this method expects the parameters ag and ab. |
ag |
Number | |
ab |
Number |
Returns
A '#rrggbb' formatted string
- Type
- String
Details
- Source
- utils/color.js, line 364
(static) rgb2hsv(color, ag, ab) → {Array}
Converts a color from the RGB color space into the HSV space. Input can be any valid HTML/CSS color definition.
Parameters
| Name | Type | Description |
|---|---|---|
color |
String | Array | Number | A valid HTML or CSS styled color value, e.g. '#12ab21', '#abc', 'black' or 'rgb(12, 132, 233)'. This can also be an array containing three color values either from 0.0 to 1.0 or from 0 to 255. They will be interpreted as red, green, and blue values. In case this is a number this method expects the parameters ag and ab. See https://www.had2know.org/technology/hsv-rgb-conversion-formula-calculator.html. |
ag |
Number | |
ab |
Number |
Returns
Contains the numbers h, s, and v value in this order.
- Type
- Array
Details
- Source
- utils/color.js, line 511
(static) rgbParser(color, ag, ab) → {Array}
Converts a valid HTML/CSS color string into a rgb value array. This is the base function for the following wrapper functions which only adjust the output to different flavors like an object, string or hex values.
Parameters
| Name | Type | Description |
|---|---|---|
color |
String | Array | Number | A valid HTML or CSS styled color value, e.g. '#12ab21', '#abc', 'black' or 'rgb(12, 132, 233)'. This can also be an array containing three color values either from 0.0 to 1.0 or from 0 to 255. They will be interpreted as red, green, and blue values. In case this is a number this method expects the parameters ag and ab. |
ag |
Number | |
ab |
Number |
Returns
RGB color values as an array [r, g, b] with values ranging from 0 to 255.
- Type
- Array
Details
- Source
- utils/color.js, line 244
(static) rgba2rgbo(rgba) → {Array}
Splits a RGBA color value like #112233AA into it's RGB and opacity parts.
Parameters
| Name | Type | Description |
|---|---|---|
rgba |
String | A RGBA color value |
Returns
An array containing the rgb color value in the first and the opacity in the second field.
- Type
- Array
Details
- Source
- utils/color.js, line 681
(static) rgbo2rgba(rgb, o) → {String}
Generates a RGBA color value like #112233AA from it's RGB and opacity parts.
Parameters
| Name | Type | Description |
|---|---|---|
rgb |
String | Array | A valid HTML or CSS styled color value, e.g. '#12ab21', '#abc', 'black' or 'rgb(12, 132, 233)'. This can also be an array containing three color values either from 0.0 to 1.0 or from 0 to 255. They will be interpreted as red, green, and blue values. |
o |
Number | The desired opacity >=0, <=1. |
Returns
The RGBA color value.
- Type
- String
Details
- Source
- utils/color.js, line 702
(static) sanitizeHTML(str, caja) → {String}
Convert HTML tags to entities or use html_sanitize if the google caja html sanitizer is available.
Parameters
| Name | Type | Description |
|---|---|---|
str |
String | |
caja |
Boolean |
Returns
Sanitized string
- Type
- String
Details
- Source
- utils/type.js, line 2042
(private, static) scaleJSXGraphDiv(wrap_id, inner_id, doc, scale)
Scale and vertically shift a DOM element (usually a JSXGraph div) inside of a parent DOM element which is set to fullscreen. This is realized with a CSS transformation.
Parameters
| Name | Type | Description |
|---|---|---|
wrap_id |
String | id of the parent DOM element which is in fullscreen mode |
inner_id |
String | id of the DOM element which is scaled and shifted |
doc |
Object | document object or shadow root |
scale |
Number | Relative size of the JSXGraph board in the fullscreen window. |
Details
(static) setClassicColors()
Use the color scheme of JSXGraph up to version 1.3.2. This method has to be called before JXG.JSXGraph.initBoard();
Example
JXG.setClassicColors();
var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-5, 5, 5,-5]});
Details
- See
- Source
- utils/color.js, line 1016
(static) shadeColor(color, percent) → {String}
Lightens (percent > 0) or darkens (percent < 0) the color by the specified factor.
Parameters
| Name | Type | Description |
|---|---|---|
color |
String | |
percent |
Number |
Returns
- Type
- String
Details
- Source
- utils/color.js, line 854
(static) shortcut(object, fun) → {function}
Creates a shortcut to a method, e.g. JXG.Board#createElement is a shortcut to JXG.Board#create. Sometimes the target is undefined by the time you want to define the shortcut so we need this little helper.
Parameters
| Name | Type | Description |
|---|---|---|
object |
Object | The object the method we want to create a shortcut for belongs to. |
fun |
String | The method we want to create a shortcut for. |
Returns
A function that calls the given method.
- Type
- function
Details
(static) stack2jsxgraph(str)
Convert a string containing a MAXIMA /STACK expression into a JSXGraph / JessieCode string or an array of JSXGraph / JessieCode strings.
This function is meanwhile superseded by stack_jxg.stack2jsxgraph.
Examples
console.log( JXG.stack2jsxgraph("%e**x") );
// Output:
// "EULER**x"
console.log( JXG.stack2jsxgraph("[%pi*(x**2 - 1), %phi*(x - 1), %gamma*(x+1)]") );
// Output:
// [ "PI*(x**2 - 1)", "1.618033988749895*(x - 1)", "0.5772156649015329*(x+1)" ]
Parameters
| Name | Type | Description |
|---|---|---|
str |
String |
Returns
String
Details
- Deprecated
- Yes
- Source
- utils/type.js, line 2096
(static) str2Bool(s) → {Boolean}
Converts a string containing either true or false into a boolean value.
Parameters
| Name | Type | Description |
|---|---|---|
s |
String | String containing either true or false. |
Returns
String typed boolean value converted to boolean.
- Type
- Boolean
Details
- Source
- utils/type.js, line 328
(static) supportsCanvas() → {Boolean}
Detect browser support for Canvas.
Returns
True, if the browser supports HTML canvas.
- Type
- Boolean
Details
- Source
- utils/env.js, line 188
(static) supportsES6()
Features of ECMAScript 6+ are available.
Details
- Type
- Boolean
- Default Value
- false
- Source
- utils/env.js, line 149
(static) supportsPointerEvents() → {Boolean}
Checks if the environments supports the W3C Pointer Events API https://www.w3.org/TR/pointerevents/
Returns
- Type
- Boolean
Details
- Source
- utils/env.js, line 257
(static) supportsSVG() → {Boolean}
Detect browser support for SVG.
Returns
True, if the browser supports SVG.
- Type
- Boolean
Details
- Source
- utils/env.js, line 175
(static) supportsVML() → {Boolean}
Detect browser support for VML.
Returns
True, if the browser supports VML.
- Type
- Boolean
Details
- Source
- utils/env.js, line 166
(static) swap(arr, i, j) → {Array}
Swaps to array elements.
Parameters
| Name | Type | Description |
|---|---|---|
arr |
Array | |
i |
Number | |
j |
Number |
Returns
Reference to the given array.
- Type
- Array
Details
- Source
- utils/type.js, line 768
(static) timedChunk(items, process, context, callback)
Process data in timed chunks. Data which takes long to process, either because it is such a huge amount of data or the processing takes some time, causes warnings in browsers about irresponsive scripts. To prevent these warnings, the processing is split into smaller pieces called chunks which will be processed in serial order. Copyright 2009 Nicholas C. Zakas. All rights reserved. MIT Licensed
Parameters
| Name | Type | Description |
|---|---|---|
items |
Array | to do |
process |
function | Function that is applied for every array item |
context |
Object | The scope of function process |
callback |
function | This function is called after the last array element has been processed. |
Details
- Source
- utils/env.js, line 939
(static) toFixed(num, digits) → {String}
Replacement of the default toFixed() method. It does a correct rounding (independent of the browser) and returns "0.00" for toFixed(-0.000001, 2) instead of "-0.00" which is returned by JavaScript's toFixed()
Parameters
| Name | Type | Description |
|---|---|---|
num |
Number | Number tp be rounded |
digits |
Number | Decimal digits |
Returns
Rounded number is returned as string
- Type
- String
Details
- Source
- utils/type.js, line 1054
(static) toFraction(x, useTeXopt, orderopt) → {String}
Convert a floating point number to a string integer + fraction. Returns either a string of the form '3 1/3' (in case of useTeX=false) or '3 \frac{1}{3}' (in case of useTeX=true).
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
x |
Number | |||
useTeX |
Boolean |
<optional> |
false
|
|
order |
Number |
<optional> |
0.001
|
Returns
- Type
- String
Details
- See
- Source
- utils/type.js, line 1984
(static) toJSON(obj, noquoteopt) → {String}
Converts a JavaScript object into a JSON string.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
obj |
Object | A JavaScript object, functions will be ignored. |
||
noquote |
Boolean |
<optional> |
false
|
No quotes around the name of a property. |
Returns
The given object stored in a JSON string.
- Type
- String
Details
- Deprecated
- Yes
- Source
- utils/type.js, line 1733
(static) toUniqueArrayFloat(arr, arr, eps) → {Array|Array}
Generates a sorted copy of an array containing numbers and removes the duplicate entries up to a supplied precision eps. An array element arr[i] will be removed if abs(arr[i] - arr[i-1]) is less than eps.
The original array will stay unaltered.
Example
var arr = [2.3, 4, Math.PI, 2.300001, Math.PI+0.000000001];
console.log(JXG.toUniqueArrayFloat(arr, 0.00001));
// Output: Array(3) [ 2.3, 3.141592653589793, 4 ]
Parameters
| Name | Type | Description |
|---|---|---|
arr |
Array | |
arr |
Array | Array of numbers |
eps |
Number | Precision |
Returns
-
- Type
- Array
-
- Type
- Array
Details
- See
- Source
- utils/type.js, line 849
(static) trim(str) → {String}
Remove all leading and trailing whitespaces from a given string.
Parameters
| Name | Type | Description |
|---|---|---|
str |
String |
Returns
- Type
- String
Details
- Source
- utils/type.js, line 1965
(static) trimNumber(str) → {String}
Make numbers given as strings nicer by removing all unnecessary leading and trailing zeroes.
Parameters
| Name | Type | Description |
|---|---|---|
str |
String |
Returns
- Type
- String
Details
- Source
- utils/type.js, line 1880
(static) trunc(n, p) → {Number}
Truncate a number n after p decimals.
Parameters
| Name | Type | Description |
|---|---|---|
n |
Number | |
p |
Number |
Returns
- Type
- Number
Details
- Source
- utils/type.js, line 962
(static) unescapeHTML(str) → {String}
Eliminates all substrings enclosed by < and > and replaces all occurences of & by &, > by >, and < by <.
Parameters
| Name | Type | Description |
|---|---|---|
str |
String |
Returns
- Type
- String
Details
- Source
- utils/type.js, line 1856
(static) uniqueArray(arr) → {Array}
Generates a copy of an array and removes the duplicate entries. The original array will be altered.
Parameters
| Name | Type | Description |
|---|---|---|
arr |
Array |
Returns
- Type
- Array
Details
- See
- Source
- utils/type.js, line 786
(static) useBlackWhiteOptions(board)
Converts all color values to greyscale and calls useStandardOption to put them onto the board.
Parameters
| Name | Type | Description |
|---|---|---|
board |
JXG.Board | The board to which objects the options will be applied. |
Details
- See
- Source
- options.js, line 11234
(static) useStandardOptions(board)
Apply the options stored in this object to all objects on the given board.
Parameters
| Name | Type | Description |
|---|---|---|
board |
JXG.Board | The board to which objects the options will be applied. |
Details
- Source
- options.js, line 11162
(static) warn(warning)
Outputs a warning via console.warn(), if available. If console.warn() is unavailable this function will look for an HTML element with the id 'warning' and append the warning to this element's innerText.
Parameters
| Name | Type | Description |
|---|---|---|
warning |
String | The warning text |
Details
Inherited
none
Classes
- appBox
- board
- themes
- AbstractRenderer
- Board
- Constructs a new Board object.
- CA
- A JessieCode object provides an interface to the parser and stores all variables and objects used within a JessieCode script.
- CanvasRenderer
- Chart
- The Chart class is a basic class for the chart object.
- Circle
- A circle consists of all points with a given distance from one point.
- Circle3D
- In 3D space, a circle consists of all points on a given plane with a given distance from a given point.
- Complex
- Creates a new complex number.
- Composition
- Coords
- Constructs a new Coordinates object.
- CoordsElement
- An element containing coords is a basic geometric element.
- Curve
- Curve3D
- Constructor for 3D curves.
- Face3D
- ForeignObject
- Construct and handle SVG foreignObjects.
- GeometryElement
- Constructs a new GeometryElement object.
- GeometryElement3D
- Constructs a new GeometryElement3D object.
- Group
- Creates a new instance of Group.
- Image
- JSXGraph
- Constructs a new JSXGraph singleton object.
- JessieCode
- Legend
- Line
- Line3D
- Constructor for 3D lines.
- NoRenderer
- Plane3D
- Constructor for 3D planes.
- Point
- A point is the basic geometric element.
- Point3D
- A 3D point is a basic geometric element.
- Polygon
- Creates a new instance of JXG.Polygon.
- Polygon3D
- Constructor for 3D polygons.
- Polyhedron3D
- A 3D polyhedron is a basic geometric element.
- SVGRenderer
- Sphere3D
- A sphere consists of all points with a given distance from a given point.
- Surface3D
- Constructor for 3D surfaces.
- Text
- Construct and handle texts.
- Text3D
- A 3D text is a basic geometric element.
- Ticks
- Creates ticks for an axis.
- Transformation
- A (2D) transformation consists of a 3x3 matrix, i.e.
- Turtle
- VMLRenderer
- View3D
Namespaces
- C
- JXG.Math.C namespace for the complex number arithmetic functions, see also JXG.Complex.
- Dump
- The JXG.Dump namespace provides classes and methods to save a board to javascript.
- EventEmitter
- JXG.EventEmitter namespace handles custom event emitters.
- Expect
The JXG.Expect namespace provides method to normalize access on coordinates, i.e.
- GeonextParser
- JXG.GeonextParser namespce with Parser helper routines.
- Math
- Namespace JXG.Math.
- Options
- JXG.Options namespace.
- Parse3D
- Namespace JXG.Parse3D.
- PrefixParser
- JXG.PrefixParser namespace provides a prefix expression parser, i.e.
- Util
- JXG.Util namespace providing general utility routines.
- XML
- JXG.XML namespace holds browser independent xml parsing routines.