Namespace JXG
↳ JXG
Defined in: loadjsxgraph.js.
Constructor Attributes | Constructor Name and Description |
---|---|
JSXGraph namespace.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
JXG.boards
Store a reference to every board in this central list.
|
<static> |
JXG.COORDS_BY_SCREEN
Constant: screen coordinates in pixel relative to the upper left corner of the div element.
|
<static> |
JXG.COORDS_BY_USER
Constant: user coordinates relative to the coordinates system defined by the bounding box.
|
<static> |
JXG.elements
Associative array that keeps track of all constructable elements registered
via JXG.registerElement.
|
<static> |
JXG.FileReader
The FileReader object bundles the file input capabilities of JSXGraph.
|
<static> |
JXG.ieVersion
Internet Explorer version.
|
<static> |
JXG.isBrowser
A document/window environment is available.
|
<static> |
JXG.licenseText
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).
|
<static> |
JXG.palette
Default color palette.
|
<static> |
JXG.paletteWong
Bang Wong color palette,
optimized for various type
of color blindness.
|
<static> |
JXG.readers
Store the available file readers in this structure.
|
<private> <static> |
JXG.touchProperty
Determines the property that stores the relevant information in the event object.
|
<static> |
JXG.Validator
Holds all possible properties and the according validators for geometry elements.
|
<static> |
JXG.version
Constant: the currently used JSXGraph version.
|
Method Attributes | Method Name and Description |
---|---|
<private> <static> |
JXG._ceil10(value, exp)
"Ceil" a number to given number of decimal digits.
|
<private> <static> |
JXG._decimalAdjust(type, value, exp)
Decimal adjustment of a number.
|
<private> <static> |
JXG._floor10(value, exp)
"Floor" a number to given number of decimal digits.
|
<private> <static> |
JXG._round10(value, exp)
Round a number to given number of decimal digits.
|
<static> |
JXG.addEvent(obj, type, fn, owner)
Adds an event listener to a DOM element.
|
<static> |
JXG.autoDigits(val)
Truncate a number val automatically.
|
<static> |
JXG.autoHighlight(color)
Determines highlight color to a given color.
|
<static> |
JXG.bind(fn, owner)
Generates a function which calls the function fn in the scope of owner.
|
<static> |
JXG.capitalize(str)
Makes a string lower case except for the first character which will be upper case.
|
<static> |
JXG.clearVisPropOld(el)
Resets visPropOld.
|
<static> |
JXG.clone(obj)
This outputs an object with a base class reference to the given object.
|
<static> |
JXG.cloneAndCopy(obj, obj2)
Embeds an existing object into another one just like #clone and copies the contents of the second object
to the new one.
|
<static> |
JXG.cmpArrays(a1, a2)
Compare two arrays.
|
<static> |
JXG.contrast(hexColor, darkColor, lightColor, threshold)
Calculate whether a light or a dark color is needed as a contrast.
|
<static> |
JXG.coordsArrayToMatrix(coords, split)
Converts an array of JXG.Coords objects into a coordinate matrix.
|
<static> |
JXG.copyAttributes(attributes, options, s)
Generates an attributes object that is filled with default values from the Options object
and overwritten by the user specified attributes.
|
<private> <static> |
JXG.copyPrototypeMethods(subObj, superObj, constructorName)
Copy all prototype methods from object "superObject" to object
"subObject".
|
<static> |
JXG.createEvalFunction(board, param, n)
Convert a String, a number or a function into a function.
|
<static> |
JXG.createFunction(term, board, variableName, evalGeonext)
Convert a String, number or function into a function.
|
<static> |
JXG.createHTMLSlider(board, parents, attributes)
[[x,y], [w px, h px], [range]
|
<static> |
JXG.debug(s)
Add something to the debug log.
|
<static> |
JXG.debugInt(s)
Add something to the debug log.
|
<static> |
JXG.debugLine(s)
Add something to the debug log.
|
<static> |
JXG.debugWST(s)
Add something to the debug log.
|
<static> |
JXG.deepCopy(obj, obj2, toLower)
Creates a deep copy of an existing object, i.e.
|
<static> |
JXG.def(v, d)
Handle default parameters.
|
<static> |
JXG.defineConstant(object, name, value, ignoreRedefine)
Set a constant name in object to value.
|
<static> |
JXG.deprecated(what, replacement)
This method issues a warning to the developer that the given function is deprecated
and, if available, offers an alternative to the deprecated function.
|
<static> |
JXG.eliminateDuplicates(a)
Eliminates duplicate entries in an array consisting of numbers and strings.
|
<static> |
JXG.escapeHTML(str)
Replaces all occurences of & by &, > by >, and < by <.
|
<static> |
JXG.evalSlider(s)
If s is a slider, it returns the sliders value, otherwise it just returns the given value.
|
<static> |
JXG.evaluate(val)
If val is a function, it will be evaluated without giving any parameters, else the input value
is just returned.
|
<static> |
JXG.exists(v, checkEmptyString)
Checks if a given variable is neither undefined nor null.
|
<static> |
JXG.extend(object, extension, onlyOwn, toLower)
Copy all properties of the extension object to object.
|
<static> |
JXG.extendConstants(object, constants, onlyOwn, toUpper)
Copy all properties of the constants object in object as a constant.
|
<static> |
JXG.filterElements(list, filter)
Filter an array of elements.
|
<static> |
JXG.getBoardByContainerId(s)
s may be the string containing the id of an HTML tag that hosts a JSXGraph board.
|
<static> |
JXG.getCSSTransform(cPos, obj)
Correct position of upper left corner in case of
a CSS transformation.
|
<static> |
JXG.getCSSTransformMatrix(obj)
Scaling CSS transformations applied to the div element containing the JSXGraph constructions
are determined.
|
<static> |
JXG.getDimensions(elementId, doc)
Reads the width and height of an HTML element.
|
<static> |
JXG.getNumberOfTouchPoints(evt)
Determines the number of touch points in a touch event.
|
<static> |
JXG.getOffset(obj)
Calculates recursively the offset of the DOM element in which the board is stored.
|
<static> |
JXG.getPosition(e, index, doc)
Cross browser mouse / touch coordinates retrieval relative to the board's top left corner.
|
<static> |
JXG.getProp(el, css)
Reads css style sheets of a given element.
|
<static> <deprecated> |
JXG.getRef(board, s)
s may be a string containing the name or id of an element or even a reference
to the element itself.
|
<static> <deprecated> |
JXG.getReference(board, s)
This is just a shortcut to JXG.getRef.
|
<static> |
JXG.getStyle(obj, stylename)
Access CSS style sheets.
|
<static> <deprecated> |
JXG.hex2rgb(hex)
Converts a valid HTML/CSS color string from the '#rrggbb' format into the 'rgb(r, g, b)' format.
|
<static> |
JXG.hsv2rgb(H, S, V)
Converts HSV color to RGB color.
|
<static> |
JXG.indexOf(array, value, sub)
Search an array for a given value.
|
<static> |
JXG.isAndroid()
Detects if the user is using an Android powered device.
|
<static> |
JXG.isApple()
Detects if the user is using a Apple iPad / iPhone.
|
<static> |
JXG.isArray(v)
Checks if a given variable references an array.
|
<static> |
JXG.isDocumentOrFragment(v)
Tests if the input variable is a DOM Document or DocumentFragment node
|
<static> |
JXG.isEmpty(v)
Checks if v is an empty object or empty.
|
<static> |
JXG.isFirefoxOS()
Detects if the user is using a firefoxOS powered device.
|
<static> |
JXG.isFirstTouch(evt)
Checks whether an mouse, pointer or touch event evt is the first event of a multitouch event.
|
<static> |
JXG.isFunction(v)
Checks if a given variable references a function.
|
<static> |
JXG.isGroup(board, s)
Checks if the given string is a group id within the given board.
|
<static> |
JXG.isId(board, s)
Checks if the given string is an id within the given board.
|
<static> |
JXG.isInArray(arr, val)
Checks if an array contains an element equal to val but does not check the type!
|
<static> |
JXG.isInObject(obj, val)
Checks if an object contains a key, whose value equals to val.
|
<static> |
JXG.isMetroApp()
Returns true if the run inside a Windows 8 "Metro" App.
|
<static> |
JXG.isMouseEvent(evt)
Determines whether evt is neither a touch event nor a pointer event.
|
<static> |
JXG.isMozilla()
Detects if the user is using a Mozilla browser
|
<static> |
JXG.isName(board, s)
Checks if the given string is a name within the given board.
|
<static> |
JXG.isNode()
True, if run inside a node.js environment.
|
<static> |
JXG.isNumber(v)
Checks if the value of a given variable is of type number.
|
<static> |
JXG.isObject(v)
Tests if the input variable is an Object
|
<static> |
JXG.isPoint(v)
Checks if a given variable is a reference of a JSXGraph Point element.
|
<static> |
JXG.isPointerEvent(evt)
Determines whether evt is a pointer event.
|
<static> |
JXG.isPointType(board, v)
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.
|
<static> |
JXG.isString(v)
Checks if the value of a given variable is of type string.
|
<static> |
JXG.isTouchDevice()
Determine if the current browser supports touch events
|
<static> |
JXG.isTouchEvent(evt)
Determines whether evt is a touch event.
|
<static> |
JXG.isTransformationOrArray(v)
Checks if a given variable is a reference of a JSXGraph transformation element or an array
of JSXGraph transformation elements.
|
<static> |
JXG.isWebkitAndroid()
Detects if the user is using the default Webkit browser on an Android powered device.
|
<static> |
JXG.isWebkitApple()
Detects if the user is using Safari on an Apple device.
|
<static> |
JXG.isWebWorker()
True if run inside a webworker environment.
|
<static> |
JXG.keys(object, onlyOwn)
Extracts the keys of a given object.
|
<static> |
JXG.LMS2rgb(l, m, s)
Convert color information from LMS to RGB color space.
|
<static> |
JXG.merge(obj1, obj2)
Recursively merges obj2 into obj1.
|
<private> <static> |
JXG.mergeAttr(attr, special, toLower)
In-place (deep) merging of attributes.
|
<static> |
JXG.normalizePointFace(s)
All point faces can be defined with more than one name, e.g.
|
<static> |
JXG.providePoints(board, parents, attrClass, attrArray, attrArray)
Test if the parents array contains existing points.
|
<static> |
JXG.providePoints3D(view, parents, attrClass, attrArray, attrArray)
Test if the parents array contains existing points.
|
<static> |
JXG.registerElement(element, creator)
This registers a new construction element to JSXGraph for the construction via the JXG.Board.create
interface.
|
<static> |
JXG.registerReader(reader, ext)
Register a file reader.
|
<static> |
JXG.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.
|
<static> |
JXG.removeElementFromArray(ar, el)
Removes an element from the given array
|
<static> |
JXG.removeEvent(obj, type, fn, owner)
Removes an event listener from a DOM element.
|
<static> |
JXG.rgb2bw(color)
Decolorizes the given color.
|
<static> |
JXG.rgb2cb(color, deficiency)
Converts a color into how a colorblind human approximately would see it.
|
<static> |
JXG.rgb2css(color, ag, ab)
Converts a valid HTML/CSS color string into a string of the 'rgb(r, g, b)' format.
|
<static> |
JXG.rgb2hex(color, ag, ab)
Converts a valid HTML/CSS color string into a HTML rgb string.
|
<static> |
JXG.rgb2hsv(color, ag, ab)
Converts a color from the RGB color space into the HSV space.
|
<static> |
JXG.rgb2LMS(color, ag, ab)
Converts a color from the RGB color space into the LMS space.
|
<static> |
JXG.rgba2rgbo(rgba)
Splits a RGBA color value like #112233AA into it's RGB and opacity parts.
|
<static> |
JXG.rgbo2rgba(rgb, o)
Generates a RGBA color value like #112233AA from it's RGB and opacity parts.
|
<static> |
JXG.rgbParser(color, ag, ab)
Converts a valid HTML/CSS color string into a rgb value array.
|
<static> |
JXG.sanitizeHTML(str, caja)
Convert HTML tags to entities or use html_sanitize if the google caja html sanitizer is available.
|
<private> <static> |
JXG.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.
|
<static> |
JXG.setClassicColors()
Use the color scheme of JSXGraph up to version 1.3.2.
|
<static> |
JXG.shortcut(object, fun)
Creates a shortcut to a method, e.g.
|
<static> |
JXG.str2Bool(s)
Converts a string containing either true or false into a boolean value.
|
<static> |
JXG.supportsCanvas()
Detect browser support for Canvas.
|
<static> |
JXG.supportsES6()
Features of ECMAScript 6+ are available.
|
<static> |
JXG.supportsPointerEvents()
Checks if the environments supports the W3C Pointer Events API http://www.w3.org/Submission/pointer-events/
|
<static> |
JXG.supportsSVG()
Detect browser support for SVG.
|
<static> |
JXG.supportsVML()
Detect browser support for VML.
|
<static> |
JXG.swap(arr, i, j)
Swaps to array elements.
|
<static> |
JXG.timedChunk(items, process, context, callback)
Process data in timed chunks.
|
<static> |
JXG.toFixed(num, digits)
Replacement of the default toFixed() method.
|
<static> |
JXG.toJSON(obj, noquote)
Converts a JavaScript object into a JSON string.
|
<static> |
JXG.trim(str)
Remove all leading and trailing whitespaces from a given string.
|
<static> |
JXG.trimNumber(str)
Make numbers given as strings nicer by removing all unnecessary leading and trailing zeroes.
|
<static> |
JXG.trunc(n, p)
Truncate a number n after p decimals.
|
<static> |
JXG.unescapeHTML(str)
Eliminates all substrings enclosed by < and > and replaces all occurences of
& by &, > by >, and < by <.
|
<static> |
JXG.uniqueArray(arr)
Generates a copy of an array and removes the duplicate entries.
|
<static> |
JXG.useBlackWhiteOptions(board)
Converts all color values to greyscale and calls useStandardOption to put them onto the board.
|
<static> |
JXG.useStandardOptions(board)
Apply the options stored in this object to all objects on the given board.
|
<static> |
JXG.warn(warning)
Outputs a warning via console.warn(), if available.
|
Namespace Detail
JXG
JSXGraph namespace. Holds all classes, objects, functions and variables belonging to JSXGraph
to reduce the risk of interfering with other JavaScript code.
Field Detail
<static>
{Object}
JXG.boards
Store a reference to every board in this central list. This will at some point
replace JXG.JSXGraph.boards.
Defined in: jxg.js.
Defined in: jxg.js.
<static>
{Number}
JXG.COORDS_BY_SCREEN
Constant: screen coordinates in pixel relative to the upper left corner of the div element.
Defined in: constants.js.
Defined in: constants.js.
<static>
{Number}
JXG.COORDS_BY_USER
Constant: user coordinates relative to the coordinates system defined by the bounding box.
Defined in: constants.js.
Defined in: constants.js.
<static>
{Object}
JXG.elements
Associative array that keeps track of all constructable elements registered
via JXG.registerElement.
Defined in: jxg.js.
Defined in: jxg.js.
<static>
JXG.FileReader
The FileReader object bundles the file input capabilities of JSXGraph.
Defined in: file.js.
Defined in: file.js.
<static>
{Number}
JXG.ieVersion
Internet Explorer version. Works only for IE > 4.
Defined in: env.js.
Defined in: env.js.
<static>
{Boolean}
JXG.isBrowser
A document/window environment is available.
Defined in: env.js.
Defined in: env.js.
- Default Value:
- false
<static>
{String}
JXG.licenseText
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).
Defined in: constants.js.
Defined in: constants.js.
<static>
{Object}
JXG.palette
Default color palette.
Contains at least color values for
Defined in: color.js.
- black
- blue
- green
- purple
- red
- white
- yellow
Defined in: color.js.
var p = board.create('line', [[-1, 1], [2, -3]], {strokeColor: JXG.palette.yellow});
- See:
- JXG.paletteWong
- Default Value:
- JXG.paletteWong
<static>
{Object}
JXG.paletteWong
Bang Wong color palette,
optimized for various type
of color blindness.
It contains values for
Defined in: color.js.
- 'black'
- 'orange'
- 'skyblue'
- 'bluishgreen'
- 'yellow'
- 'darkblue'
- 'vermillion'
- 'reddishpurple'
- black (= #000000)
- blue (= darkblue)
- green (= bluishgreen)
- purple (= reddishpurple)
- red (= vermillion)
- white (= #ffffff)
Defined in: color.js.
var p = board.create('line', [[-1, 1], [2, -3]], {strokeColor: JXG.paletteWong.yellow});
- See:
- JXG.palette
<static>
{Object}
JXG.readers
Store the available file readers in this structure.
Defined in: jxg.js.
Defined in: jxg.js.
<private> <static>
{String}
JXG.touchProperty
Determines the property that stores the relevant information in the event object.
Defined in: env.js.
Defined in: env.js.
- Default Value:
- 'touches'
<static>
JXG.Validator
Holds all possible properties 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.
Defined in: options.js.
Defined in: options.js.
<static>
{String}
JXG.version
Constant: the currently used JSXGraph version.
Defined in: constants.js.
Defined in: constants.js.
Method Detail
<private> <static>
{Number}
JXG._ceil10(value, exp)
"Ceil" a number to given number of decimal digits.
Example: JXG._toFixed(3.14159, -2) gives 3.15
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Number} value
- Number to be ceiled
- {Number} exp
- Number of decimal digits given as negative exponent
- Returns:
- {Number} "Ceiled" number.
<private> <static>
{Number}
JXG._decimalAdjust(type, value, exp)
Decimal adjustment of a number.
From https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Math/round
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {String} type
- The type of adjustment.
- {Number} value
- The number.
- {Number} exp
- The exponent (the 10 logarithm of the adjustment base).
- Returns:
- {Number} The adjusted value.
<private> <static>
{Number}
JXG._floor10(value, exp)
"Floor" a number to given number of decimal digits.
Example: JXG._toFixed(3.14159, -2) gives 3.14
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Number} value
- Number to be floored
- {Number} exp
- Number of decimal digits given as negative exponent
- Returns:
- {Number} "Floored" number.
<private> <static>
{Number}
JXG._round10(value, exp)
Round a number to given number of decimal digits.
Example: JXG._toFixed(3.14159, -2) gives 3.14
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Number} value
- Number to be rounded
- {Number} exp
- Number of decimal digits given as negative exponent
- Returns:
- {Number} Rounded number.
<static>
JXG.addEvent(obj, type, fn, owner)
Adds an event listener to a DOM element.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- {Object} obj
- Reference to a DOM node.
- {String} type
- The event to catch, without leading 'on', e.g. 'mousemove' instead of 'onmousemove'.
- {Function} fn
- The function to call when the event is triggered.
- {Object} owner
- The scope in which the event trigger is called.
<static>
{Number}
JXG.autoDigits(val)
Truncate a number val automatically.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- val
- Returns:
- {Number}
<static>
{String}
JXG.autoHighlight(color)
Determines highlight color to a given color. Done by reducing (or increasing) the opacity.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {String} color
- HTML RGBA string containing the HTML color code.
- Returns:
- {String} Returns a HTML RGBA color string
<static>
{Function}
JXG.bind(fn, owner)
Generates a function which calls the function fn in the scope of owner.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Function} fn
- Function to call.
- {Object} owner
- Scope in which fn is executed.
- Returns:
- {Function} A function with the same signature as fn.
<static>
{String}
JXG.capitalize(str)
Makes a string lower case except for the first character which will be upper case.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {String} str
- Arbitrary string
- Returns:
- {String} The capitalized string.
<static>
{GeometryElement}
JXG.clearVisPropOld(el)
Resets visPropOld.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {JXG.GeometryElement} el
- Returns:
- {GeometryElement}
<static>
{Object}
JXG.clone(obj)
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.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Object} obj
- Object to be embedded.
- Returns:
- {Object} An object with a base class reference to obj.
<static>
{Object}
JXG.cloneAndCopy(obj, obj2)
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.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Object} obj
- Object to be copied.
- {Object} obj2
- Object with data that is to be copied to the new one as well.
- Returns:
- {Object} Copy of given object including some new/overwritten data from obj2.
<static>
{Boolean}
JXG.cmpArrays(a1, a2)
Compare two arrays.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Array} a1
- {Array} a2
- Returns:
- {Boolean} true, if the arrays coefficients are of same type and value.
<static>
{String}
JXG.contrast(hexColor, darkColor, lightColor, threshold)
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.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {String} hexColor
- HEX value of color.
- {String} darkColor Optional, Default: "#000000"
- HEX string for a dark color.
- {String} lightColor Optional, Default: "#ffffff"
- HEX string for a light color.
- {Number} threshold Optional, Default: 8
- Returns:
- {String} Returns darkColor or lightColor.
<static>
{Array}
JXG.coordsArrayToMatrix(coords, split)
- Parameters:
- {Array} coords
- {Boolean} split
- Returns:
- {Array}
<static>
{Object}
JXG.copyAttributes(attributes, options, s)
Generates an attributes object that is filled with default values from the Options object
and overwritten by the user specified attributes.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Object} attributes
- user specified attributes
- {Object} options
- defaults options
- {String} s
- variable number of strings, e.g. 'slider', subtype 'point1'.
- Returns:
- {Object} The resulting attributes object
<private> <static>
{String}
JXG.copyPrototypeMethods(subObj, superObj, constructorName)
Copy all prototype methods from object "superObject" to object
"subObject". The constructor of superObject will be available
in subObject as subObject.constructor[constructorName].
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Object} subObj
- A JavaScript object which receives new methods.
- {Object} superObj
- A JavaScript object which lends its prototype methods to subObject
- constructorName
- Returns:
- {String} constructorName Under this name the constructor of superObj will be available in subObject.
<static>
{Function}
JXG.createEvalFunction(board, param, n)
Convert a String, a number or a function into a function. This method is used in Transformation.js
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {JXG.Board} board
- Reference to a JSXGraph board. It is required to resolve dependencies given by a GEONEXT string, thus it must be a valid reference only in case one of the param values is of type string.
- {Array} param
- An array containing strings, numbers, or functions.
- {Number} n
- Length of param.
- Returns:
- {Function} A function taking one parameter k which specifies the index of the param element to evaluate.
<static>
{Function}
JXG.createFunction(term, board, variableName, evalGeonext)
Convert a String, number or function into a function.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {String|Number|Function} term
- A variable of type string, function or number.
- {JXG.Board} board
- Reference to a JSXGraph board. It is required to resolve dependencies given by a GEONEXT string, thus it must be a valid reference only in case one of the param values is of type string.
- {String} variableName
- Only required if evalGeonext is set to true. Describes the variable name of the variable in a GEONEXT string given as term.
- {Boolean} evalGeonext Optional, Default: true
- Set this true, if term should be treated as a GEONEXT string.
- Returns:
- {Function} A function evaluation the value given by term or null if term is not of type string, function or number.
<static>
JXG.createHTMLSlider(board, parents, attributes)
[[x,y], [w px, h px], [range]
Defined in: text.js.
Defined in: text.js.
- Parameters:
- board
- parents
- attributes
<static>
JXG.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.
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- s
- An arbitrary number of parameters.
- See:
- JXG#debugWST
- JXG#debugLine
- JXG#debugInt
<static>
JXG.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.
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- s
- An arbitrary number of parameters.
- See:
- JXG#debugWST
<static>
JXG.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).
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- s
- An arbitrary number of parameters.
- See:
- JXG#debug
<static>
JXG.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).
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- s
- An arbitrary number of parameters.
- See:
- JXG#debug
<static>
{Object}
JXG.deepCopy(obj, obj2, toLower)
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.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Object} obj
- This object will be copied.
- {Object} obj2
- This object will merged into the newly created object
- {Boolean} toLower Optional, Default: false
- If true the keys are convert to lower case. This is needed for visProp, see JXG#copyAttributes
- Returns:
- {Object} copy of obj or merge of obj and obj2.
<static>
JXG.def(v, d)
Handle default parameters.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- v
- Given value
- d
- Default value
- Returns:
- d, if v is undefined or null.
<static>
JXG.defineConstant(object, name, value, ignoreRedefine)
Set a constant name in object to value. The value can't be changed after declaration.
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- {Object} object
- {String} name
- {Number|String|Boolean} value
- {Boolean} ignoreRedefine
- This should be left at its default: false.
<static>
JXG.deprecated(what, replacement)
This method issues a warning to the developer that the given function is deprecated
and, if available, offers an alternative to the deprecated function.
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- {String} what
- Describes the function that is deprecated
- {String} replacement Optional
- The replacement that should be used instead.
<static>
{Array}
JXG.eliminateDuplicates(a)
Eliminates duplicate entries in an array consisting of numbers and strings.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Array} a
- An array of numbers and/or strings.
- Returns:
- {Array} The array with duplicate entries eliminated.
<static>
{String}
JXG.escapeHTML(str)
Replaces all occurences of & by &, > by >, and < by <.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {String} str
- Returns:
- {String}
<static>
{*}
JXG.evalSlider(s)
If s is a slider, it returns the sliders value, otherwise it just returns the given value.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {*} s
- Returns:
- {*} s.Value() if s is an element of type slider, s otherwise
<static>
JXG.evaluate(val)
If val is a function, it will be evaluated without giving any parameters, else the input value
is just returned.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- val
- Could be anything. Preferably a number or a function.
- Returns:
- If val is a function, it is evaluated and the result is returned. Otherwise val is returned.
<static>
{Boolean}
JXG.exists(v, checkEmptyString)
Checks if a given variable is neither undefined nor null. You should not use this together with global
variables!
Defined in: type.js.
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- {Boolean} checkEmptyString Optional, Default: false
- If set to true, it is also checked whether v is not equal to ''.
- Returns:
- {Boolean} True, if v is neither undefined nor null.
<static>
JXG.extend(object, extension, onlyOwn, toLower)
Copy all properties of the extension object to object.
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- {Object} object
- {Object} extension
- {Boolean} onlyOwn Optional, Default: false
- Only consider properties that belong to extension itself, not any inherited properties.
- {Boolean} toLower Optional, Default: false
- If true the keys are convert to lower case. This is needed for visProp, see JXG#copyAttributes
<static>
JXG.extendConstants(object, constants, onlyOwn, toUpper)
Copy all properties of the constants object in object as a constant.
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- {Object} object
- {Object} constants
- {Boolean} onlyOwn Optional, Default: false
- Only consider properties that belong to extension itself, not any inherited properties.
- {Boolean} toUpper Optional, Default: false
- If true the keys are convert to lower case. This is needed for visProp, see JXG#copyAttributes
<static>
{Array}
JXG.filterElements(list, filter)
Filter an array of elements.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Array} list
- {Object|function} filter
- Returns:
- {Array}
<static>
{Object}
JXG.getBoardByContainerId(s)
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.
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- {String} s
- String of an HTML tag that hosts a JSXGraph board
- Returns:
- {Object} Reference to the board or null.
<static>
{Array}
JXG.getCSSTransform(cPos, obj)
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.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- {Array} cPos
- Previously determined position
- {Object} obj
- A DOM element
- Returns:
- {Array} The corrected position.
<static>
{Array}
JXG.getCSSTransformMatrix(obj)
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.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- obj
- Returns:
- {Array} 3x3 transformation matrix without translation part. See JXG.Board#updateCSSTransforms.
<static>
{Object}
JXG.getDimensions(elementId, doc)
Reads the width and height of an HTML element.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- {String} elementId
- The HTML id of an HTML DOM node.
- doc
- Returns:
- {Object} An object with the two properties width and height.
<static>
{Number}
JXG.getNumberOfTouchPoints(evt)
Determines the number of touch points in a touch event.
For other events, -1 is returned.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- evt
- {Event}
- Returns:
- {Number}
<static>
{Array}
JXG.getOffset(obj)
Calculates recursively the offset of the DOM element in which the board is stored.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- {Object} obj
- A DOM element
- Returns:
- {Array} An array with the elements left and top offset.
<static>
{Array}
JXG.getPosition(e, index, doc)
Cross browser mouse / touch coordinates retrieval relative to the board's top left corner.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- {Object} e Optional
- The browsers event object. If omitted, window.event will be used.
- {Number} index Optional
- If e is a touch event, this provides the index of the touch coordinates, i.e. it determines which finger.
- {Object} doc Optional
- The document object.
- Returns:
- {Array} Contains the position as x,y-coordinates in the first resp. second component.
<static>
{number}
JXG.getProp(el, css)
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.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- {DOMElement} el
- {string} css
- Returns:
- {number}
<static>
{Object}
JXG.getRef(board, s)
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.
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- {JXG.Board} board
- Reference to the board the element belongs to.
- {String} s
- String or reference to a JSXGraph element.
- Deprecated:
- Use JXG.Board#select
- Returns:
- {Object} Reference to the object given in parameter object
<static>
JXG.getReference(board, s)
- Parameters:
- board
- s
- Deprecated:
- Use JXG.Board#select.
<static>
JXG.getStyle(obj, stylename)
Access CSS style sheets.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- {Object} obj
- A DOM element
- {String} stylename
- The CSS property to read.
- Returns:
- The value of the CSS property and undefined if it is not set.
<static>
{String}
JXG.hex2rgb(hex)
Converts a valid HTML/CSS color string from the '#rrggbb' format into the 'rgb(r, g, b)' format.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {String} hex
- A valid HTML or CSS styled color value, e.g. '#12ab21', '#abc', or 'black'
- Deprecated:
- Use JXG#rgb2css instead.
- Returns:
- {String} A 'rgb(r, g, b)' formatted string
<static>
{String}
JXG.hsv2rgb(H, S, V)
Converts HSV color to RGB color.
Based on C Code in "Computer Graphics -- Principles and Practice,"
Foley et al, 1996, p. 593.
See also http://www.efg2.com/Lab/Graphics/Colors/HSV.htm
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {Number} H
- value between 0 and 360
- {Number} S
- value between 0.0 (shade of gray) to 1.0 (pure color)
- {Number} V
- value between 0.0 (black) to 1.0 (white)
- Returns:
- {String} RGB color string
<static>
{Number}
JXG.indexOf(array, value, sub)
Search an array for a given value.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Array} array
- value
- {String} sub Optional
- Use this property if the elements of the array are objects.
- Returns:
- {Number} The index of the first appearance of the given value, or -1 if the value was not found.
<static>
{Boolean}
JXG.isAndroid()
Detects if the user is using an Android powered device.
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isApple()
Detects if the user is using a Apple iPad / iPhone.
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isArray(v)
Checks if a given variable references an array.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type array.
<static>
JXG.isDocumentOrFragment(v)
Tests if the input variable is a DOM Document or DocumentFragment node
Defined in: type.js.
Defined in: type.js.
- Parameters:
- v
- A variable of any type
<static>
{boolean}
JXG.isEmpty(v)
Checks if v is an empty object or empty.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- v
- {Object|Array}
- Returns:
- {boolean} True, if v is an empty object or array.
<static>
{Boolean}
JXG.isFirefoxOS()
Detects if the user is using a firefoxOS powered device.
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean}
<static>
{boolean}
JXG.isFirstTouch(evt)
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!
Defined in: env.js.
Defined in: env.js.
- Parameters:
- evt
- {Event}
- Returns:
- {boolean}
<static>
{Boolean}
JXG.isFunction(v)
Checks if a given variable references a function.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is a function.
<static>
{Boolean}
JXG.isGroup(board, s)
Checks if the given string is a group id within the given board.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {JXG.Board} board
- {String} s
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isId(board, s)
Checks if the given string is an id within the given board.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {JXG.Board} board
- {String} s
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isInArray(arr, val)
Checks if an array contains an element equal to val but does not check the type!
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Array} arr
- val
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isInObject(obj, val)
Checks if an object contains a key, whose value equals to val.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Object} obj
- val
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isMetroApp()
Returns true if the run inside a Windows 8 "Metro" App.
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isMouseEvent(evt)
Determines whether evt is neither a touch event nor a pointer event.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- evt
- {Event}
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isMozilla()
Detects if the user is using a Mozilla browser
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isName(board, s)
Checks if the given string is a name within the given board.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {JXG.Board} board
- {String} s
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isNode()
True, if run inside a node.js environment.
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isNumber(v)
Checks if the value of a given variable is of type number.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type number.
<static>
JXG.isObject(v)
Tests if the input variable is an Object
Defined in: type.js.
Defined in: type.js.
- Parameters:
- v
<static>
{Boolean}
JXG.isPoint(v)
Checks if a given variable is a reference of a JSXGraph Point element.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type JXG.Point.
<static>
{Boolean}
JXG.isPointerEvent(evt)
Determines whether evt is a pointer event.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- evt
- {Event}
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isPointType(board, v)
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.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {JXG.Board} board
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type JXG.Point.
<static>
{Boolean}
JXG.isString(v)
Checks if the value of a given variable is of type string.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type string.
<static>
{Boolean}
JXG.isTouchDevice()
Determine if the current browser supports touch events
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean} True, if the browser supports touch events.
<static>
{Boolean}
JXG.isTouchEvent(evt)
Determines whether evt is a touch event.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- evt
- {Event}
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isTransformationOrArray(v)
Checks if a given variable is a reference of a JSXGraph transformation element or an array
of JSXGraph transformation elements.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type JXG.Transformation.
<static>
{Boolean}
JXG.isWebkitAndroid()
Detects if the user is using the default Webkit browser on an Android powered device.
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isWebkitApple()
Detects if the user is using Safari on an Apple device.
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.isWebWorker()
True if run inside a webworker environment.
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean}
<static>
{Array}
JXG.keys(object, onlyOwn)
Extracts the keys of a given object.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- 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:
- {Array} All keys of the given object.
<static>
{Array}
JXG.LMS2rgb(l, m, s)
Convert color information from LMS to RGB color space.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {Number} l
- {Number} m
- {Number} s
- Returns:
- {Array} Contains the r, g, and b value in this order.
<static>
{Object}
JXG.merge(obj1, obj2)
Recursively merges obj2 into obj1. Contrary to JXG#deepCopy this won't create a new object
but instead will overwrite obj1.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Object} obj1
- {Object} obj2
- Returns:
- {Object}
<private> <static>
JXG.mergeAttr(attr, special, toLower)
In-place (deep) merging of attributes. Allows attributes like `{shadow: {enabled: true...}}`
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Object} attr
- Object with attributes - usually containing default options
- {Object} special
- Special option values which overwrite (recursively) the default options
- {Boolean} toLower Optional, Default: true
- If true the keys are convert to lower case.
<static>
{String}
JXG.normalizePointFace(s)
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:
Defined in: options.js.
Input | Output |
---|---|
cross, x | x |
circle, o | o |
square, [] | [] |
plus, + | + |
diamond, <> | <> |
triangleup, a, ^ | A |
triangledown, v | v |
triangleleft, < | < |
triangleright, > | > |
Defined in: options.js.
- Parameters:
- {String} s
- A string which should determine a valid point face.
- Returns:
- {String} Returns a normalized string or undefined if the given string is not a valid point face.
<static>
{Array}
JXG.providePoints(board, parents, attrClass, attrArray, attrArray)
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.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {JXG.Board} board
- Board object
- {Array} parents
- Array containing parent elements for a new object. This array may contain
- JXG.Point objects
- JXG.GeometryElement#name of JXG.Point objects
- JXG.GeometryElement#id of JXG.Point objects
- Coordinates of points given as array of numbers of length two or three, e.g. [2, 3].
- Coordinates of points given as array of functions of length two or three. Each function returns one coordinate, e.g. [function(){ return 2; }, function(){ return 3; }]
- Function returning coordinates, e.g. function() { return [2, 3]; }
- {String} attrClass
- Main attribute class of newly created points, see JXG#copyAttributes
- {Array} attrArray
- List of subtype attributes for the newly created points. The list of subtypes is mapped to the list of new points.
- attrArray
- Returns:
- {Array} List of newly created JXG.Point elements or false if not all returned elements are points.
<static>
{Array}
JXG.providePoints3D(view, parents, attrClass, attrArray, attrArray)
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.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {JXG.View3D} view
- View3D object
- {Array} parents
- Array containing parent elements for a new object. This array may contain
- JXG.Point3D objects
- JXG.GeometryElement#name of JXG.Point3D objects
- JXG.GeometryElement#id of JXG.Point3D objects
- Coordinates of 3D points given as array of numbers of length three, e.g. [2, 3, 1].
- Coordinates of 3D points given as array of functions of length three. Each function returns one coordinate, e.g. [function(){ return 2; }, function(){ return 3; }, function(){ return 1; }]
- Function returning coordinates, e.g. function() { return [2, 3, 1]; }
- {String} attrClass
- Main attribute class of newly created 3D points, see JXG#copyAttributes
- {Array} attrArray
- List of subtype attributes for the newly created 3D points. The list of subtypes is mapped to the list of new 3D points.
- attrArray
- Returns:
- {Array} List of newly created JXG.Point3D elements or false if not all returned elements are 3D points.
<static>
JXG.registerElement(element, creator)
This registers a new construction element to JSXGraph for the construction via the JXG.Board.create
interface.
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- {String} element
- The elements name. This is case-insensitive, existing elements with the same name will be overwritten.
- {Function} creator
- 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 JXG.create... function for an example.
<static>
JXG.registerReader(reader, ext)
Register a file reader.
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- {function} reader
- A file reader. This object has to provide two methods: prepareString() and read().
- {Array} ext
<static>
JXG.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.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- {Object} obj
- Reference to a DOM node.
- {String} type
- The event to catch, without leading 'on', e.g. 'mousemove' instead of 'onmousemove'.
- {Object} owner
- The scope in which the event trigger is called.
<static>
{Array}
JXG.removeElementFromArray(ar, el)
Removes an element from the given array
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Array} ar
- el
- Returns:
- {Array}
<static>
JXG.removeEvent(obj, type, fn, owner)
Removes an event listener from a DOM element.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- {Object} obj
- Reference to a DOM node.
- {String} type
- The event to catch, without leading 'on', e.g. 'mousemove' instead of 'onmousemove'.
- {Function} fn
- The function to call when the event is triggered.
- {Object} owner
- The scope in which the event trigger is called.
<static>
{String}
JXG.rgb2bw(color)
Decolorizes the given color.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {String} color
- HTML string containing the HTML color code.
- Returns:
- {String} Returns a HTML color string
<static>
{String}
JXG.rgb2cb(color, deficiency)
Converts a color into how a colorblind human approximately would see it.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {String} color
- HTML string containing the HTML color code.
- {String} deficiency
- The type of color blindness. Possible options are protanopia, deuteranopia, and tritanopia.
- Returns:
- {String} Returns a HTML color string
<static>
{String}
JXG.rgb2css(color, ag, ab)
Converts a valid HTML/CSS color string into a string of the 'rgb(r, g, b)' format.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {String|Array|Number} color
- 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.
- {Number} ag
- {Number} ab
- Returns:
- {String} A 'rgb(r, g, b)' formatted string
<static>
{String}
JXG.rgb2hex(color, ag, ab)
Converts a valid HTML/CSS color string into a HTML rgb string.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {String|Array|Number} color
- 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.
- {Number} ag
- {Number} ab
- Returns:
- {String} A '#rrggbb' formatted string
<static>
{Array}
JXG.rgb2hsv(color, ag, ab)
Converts a color from the RGB color space into the HSV space. Input can be any valid HTML/CSS color definition.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {String|Array|Number} color
- 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.
- {Number} ag
- {Number} ab
- Returns:
- {Array} Contains the h, s, and v value in this order.
- See:
- http://zach.in.tu-clausthal.de/teaching/cg1_0708/folien/13_color_3_4up.pdf
<static>
{Array}
JXG.rgb2LMS(color, ag, ab)
Converts a color from the RGB color space into the LMS space. Input can be any valid HTML/CSS color definition.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {String|Array|Number} color
- 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.
- {Number} ag
- {Number} ab
- Returns:
- {Array} Contains the l, m, and s value in this order.
<static>
{Array}
JXG.rgba2rgbo(rgba)
Splits a RGBA color value like #112233AA into it's RGB and opacity parts.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {String} rgba
- A RGBA color value
- Returns:
- {Array} An array containing the rgb color value in the first and the opacity in the second field.
<static>
{String}
JXG.rgbo2rgba(rgb, o)
Generates a RGBA color value like #112233AA from it's RGB and opacity parts.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {String} rgb
- A RGB color value.
- {Number} o
- The desired opacity >=0, <=1.
- Returns:
- {String} The RGBA color value.
<static>
{Array}
JXG.rgbParser(color, ag, ab)
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.
Defined in: color.js.
Defined in: color.js.
- Parameters:
- {String|Array|Number} color
- 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.
- {Number} ag
- {Number} ab
- Returns:
- {Array} RGB color values as an array [r, g, b] with values ranging from 0 to 255.
<static>
{String}
JXG.sanitizeHTML(str, caja)
Convert HTML tags to entities or use html_sanitize if the google caja html sanitizer is available.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {String} str
- {Boolean} caja
- Returns:
- {String} Sanitized string
<private> <static>
JXG.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.
Defined in: env.js.
Defined in: env.js.
- Parameters:
- {String} wrap_id
- id of the parent DOM element which is in fullscreen mode
- {String} inner_id
- id of the DOM element which is scaled and shifted
- {Object} doc
- document object or shadow root
- {Number} scale
- Relative size of the JSXGraph board in the fullscreen window.
<static>
JXG.setClassicColors()
Use the color scheme of JSXGraph up to version 1.3.2.
This method has to be called before JXG.JSXGraph.initBoard();
Defined in: color.js.
Defined in: color.js.
- Examples:
JXG.setClassicColors(); var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-5, 5, 5,-5]});
<static>
{Function}
JXG.shortcut(object, fun)
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.
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- {Object} object
- The object the method we want to create a shortcut for belongs to.
- {String} fun
- The method we want to create a shortcut for.
- Returns:
- {Function} A function that calls the given method.
<static>
{Boolean}
JXG.str2Bool(s)
Converts a string containing either true or false into a boolean value.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {String} s
- String containing either true or false.
- Returns:
- {Boolean} String typed boolean value converted to boolean.
<static>
{Boolean}
JXG.supportsCanvas()
Detect browser support for Canvas.
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean} True, if the browser supports HTML canvas.
<static>
{Boolean}
JXG.supportsES6()
Features of ECMAScript 6+ are available.
Defined in: env.js.
Defined in: env.js.
<static>
{Boolean}
JXG.supportsPointerEvents()
Checks if the environments supports the W3C Pointer Events API http://www.w3.org/Submission/pointer-events/
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean}
<static>
{Boolean}
JXG.supportsSVG()
Detect browser support for SVG.
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean} True, if the browser supports SVG.
<static>
{Boolean}
JXG.supportsVML()
Detect browser support for VML.
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean} True, if the browser supports VML.
<static>
{Array}
JXG.swap(arr, i, j)
Swaps to array elements.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Array} arr
- {Number} i
- {Number} j
- Returns:
- {Array} Reference to the given array.
<static>
JXG.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
Defined in: env.js.
Defined in: env.js.
- Parameters:
- {Array} items
- to do
- {Function} process
- Function that is applied for every array item
- {Object} context
- The scope of function process
- {Function} callback
- This function is called after the last array element has been processed.
<static>
{String}
JXG.toFixed(num, digits)
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()
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Number} num
- Number tp be rounded
- {Number} digits
- Decimal digits
- Returns:
- {String} Rounded number is returned as string
<static>
{String}
JXG.toJSON(obj, noquote)
Converts a JavaScript object into a JSON string.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Object} obj
- A JavaScript object, functions will be ignored.
- {Boolean} noquote Optional, Default: false
- No quotes around the name of a property.
- Returns:
- {String} The given object stored in a JSON string.
<static>
{String}
JXG.trim(str)
Remove all leading and trailing whitespaces from a given string.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {String} str
- Returns:
- {String}
<static>
{String}
JXG.trimNumber(str)
Make numbers given as strings nicer by removing all unnecessary leading and trailing zeroes.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {String} str
- Returns:
- {String}
<static>
{Number}
JXG.trunc(n, p)
Truncate a number n after p decimals.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Number} n
- {Number} p
- Returns:
- {Number}
<static>
{String}
JXG.unescapeHTML(str)
Eliminates all substrings enclosed by < and > and replaces all occurences of
& by &, > by >, and < by <.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {String} str
- Returns:
- {String}
<static>
{Array}
JXG.uniqueArray(arr)
Generates a copy of an array and removes the duplicate entries. The original
Array will be altered.
Defined in: type.js.
Defined in: type.js.
- Parameters:
- {Array} arr
- Returns:
- {Array}
<static>
JXG.useBlackWhiteOptions(board)
Converts all color values to greyscale and calls useStandardOption to put them onto the board.
Defined in: options.js.
Defined in: options.js.
- Parameters:
- {JXG.Board} board
- The board to which objects the options will be applied.
- See:
- #useStandardOptions
<static>
JXG.useStandardOptions(board)
Apply the options stored in this object to all objects on the given board.
Defined in: options.js.
Defined in: options.js.
- Parameters:
- {JXG.Board} board
- The board to which objects the options will be applied.
<static>
JXG.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 innerHTML.
Defined in: jxg.js.
Defined in: jxg.js.
- Parameters:
- {String} warning
- The warning text