Namespace JXG
↳ JXG
Defined in: jxg.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
JXG is the top object of JSXGraph and defines the 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.licenseLogo
JSXGraph logo: base64 data-URL of img/png/screen/jsxgraph-logo_black-square-solid.svg
|
| <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.
|
| <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, options)
Adds an event listener to a DOM element.
|
| <static> |
JXG.appBox(box, attributes)
Create a JSXGraph div element containing a JSXGraph board inside of a user supplied div.
|
| <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.board(box, attributes)
Initialize a new board.
|
| <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.concat(dest, src)
Concat array src to array dest.
|
| <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.cssParse(styles)
Converts a given CSS style string into a JavaScript object.
|
| <static> |
JXG.cssStringify(styles)
Converts a given object into a CSS style string.
|
| <static> |
JXG.darkenColor(color, percent)
Darkens the color by the specified factor.
|
| <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.
|
| <private> <static> |
JXG.getCloneObject(el)
Create a stripped down version of a JSXGraph element for cloning to the background.
|
| <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 / pointer / touch coordinates retrieval relative to the documents'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.isBoard(v)
Checks if the given object is an JSXGraph board.
|
| <static> |
JXG.isDesktop()
Detects if the user is using a desktop device, see https://stackoverflow.com/a/61073480.
|
| <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.isMobile()
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.
|
| <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, acceptStringNumber, acceptNaN)
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.isPoint3D(v)
Checks if a given variable is a reference of a JSXGraph Point3D 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.isPointType3D(board, v)
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.
|
| <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.keysToLowerCase(obj)
Convert an object to a new object containing only
lower case properties.
|
| <static> |
JXG.lightenColor(color, percent)
Lightens the color by the specified factor.
|
| <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 in-place.
|
| <static> |
JXG.mergeAttr(attr, special, toLower, ignoreUndefinedSpecials)
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.parseNumber(v, percentOfWhat, convertPx)
Convert value v.
|
| <static> |
JXG.parsePosition(str)
Parse a string for label positioning of the form 'left pos' or 'pos right'
and return 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.shadeColor(color, percent)
Lightens (percent > 0) or darkens (percent < 0) the color by the specified factor.
|
| <static> |
JXG.shortcut(object, fun)
Creates a shortcut to a method, e.g.
|
| <static> |
JXG.stack2jsxgraph(str)
Convert a string containing a MAXIMA /STACK expression into a JSXGraph / JessieCode string
or an array of JSXGraph / JessieCode strings.
|
| <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 https://www.w3.org/TR/pointerevents/
|
| <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.toFraction(x, useTeX, order)
Convert a floating point number to a string integer + fraction.
|
| <static> |
JXG.toJSON(obj, noquote)
Converts a JavaScript object into a JSON string.
|
| <static> |
JXG.toUniqueArrayFloat(arr, arr, eps)
Generates a sorted copy of an array containing numbers and removes the duplicate entries up to a supplied precision eps.
|
| <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.
|
Defined in: constants.js.
Defined in: constants.js.
Defined in: file.js.
Defined in: env.js.
Defined in: env.js.
- Default Value:
- false
Defined in: constants.js.
Defined in: constants.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
- '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
Defined in: options.js.
Defined in: constants.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.
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.
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.
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.
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.
- {Object|Boolean} options Optional, Default: 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.
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: {
style: '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.
- Parameters:
- {String|Object} box
- id of or reference to the HTML element in which the board is painted into a sub-element of type div.
- {Object} attributes
- An object that sets some of the board properties and properties 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:
- {JXG.Board} Reference to the created board.
- Examples:
// 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
style: '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>
Defined in: type.js.
- Parameters:
- val
- Returns:
- {Number}
Defined in: color.js.
- Parameters:
- {String} color
- HTML RGBA string containing the HTML color code.
- Returns:
- {String} Returns a HTML RGBA color string
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.
- Parameters:
- {String|Object} box
- id of or reference to the HTML element in which the board is painted.
- {Object} attributes
- An object that sets some of the board properties. 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:
- {JXG.Board} Reference to the created board.
- 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
}
}
}
});
Defined in: type.js.
- Parameters:
- {String} str
- Arbitrary string
- Returns:
- {String} The capitalized string.
Defined in: type.js.
- Parameters:
- {JXG.GeometryElement} el
- Returns:
- {GeometryElement}
Defined in: type.js.
- Parameters:
- {Object} obj
- Object to be embedded.
- Returns:
- {Object} An object with a base class reference to obj.
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.
Defined in: type.js.
- Parameters:
- {Array} a1
- {Array} a2
- Returns:
- {Boolean} true, if the arrays coefficients are of same type and value.
Attention: if "dest" is an anonymous array, the correct result is returned from the function.
Defined in: type.js.
- Parameters:
- {Array} dest
- {Array} src
- Returns:
- Array
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.
- Parameters:
- {Array} coords
- {Boolean} split
- Returns:
- {Array}
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'. Must be provided in lower case!
- Returns:
- {Object} The resulting attributes object
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.
Defined in: type.js.
- Parameters:
- {JXG.Board} 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.
- {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.
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 JessieCode/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 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.
- {Boolean} evalGeonext Optional, Default: false
- Obsolete and ignored! Set this true if term should be treated as a GEONEXT string.
- Returns:
- {Function} A function evaluating the value given by term or null if term is not of type string, function or number.
Defined in: text.js.
- Parameters:
- board
- parents
- attributes
Defined in: type.js.
- Parameters:
- {String} styles
- String containing CSS styles.
- Returns:
- {Object} Object containing CSS styles.
Defined in: type.js.
- Parameters:
- {Object} styles
- Object containing CSS styles.
- Returns:
- {String} String containing CSS styles.
Defined in: color.js.
- Parameters:
- {String} color
- {Number} percent
- Returns:
- {String}
- See:
- JXG.shadeColor
- Parameters:
- s
- An arbitrary number of parameters.
- Parameters:
- s
- An arbitrary number of parameters.
- See:
- JXG.debugWST
- Parameters:
- s
- An arbitrary number of parameters.
- See:
- JXG.debug
- Parameters:
- s
- An arbitrary number of parameters.
- See:
- JXG.debug
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.
Defined in: type.js.
- Parameters:
- v
- Given value
- d
- Default value
- Returns:
- d, if v is undefined or null.
- Parameters:
- {Object} object
- {String} name
- {Number|String|Boolean} value
- {Boolean} ignoreRedefine
- This should be left at its default: false.
- Parameters:
- {String} what
- Describes the function that is deprecated
- {String} replacement Optional
- The replacement that should be used instead.
Defined in: type.js.
- Parameters:
- {Array} a
- An array of numbers and/or strings.
- Returns:
- {Array} The array with duplicate entries eliminated.
Defined in: type.js.
- Parameters:
- {String} str
- Returns:
- {String}
Defined in: type.js.
- Parameters:
- {*} s
- Returns:
- {*} s.Value() if s is an element of type slider, s otherwise
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.
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.
- 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
- 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
Defined in: type.js.
- Parameters:
- {Array} list
- {Object|function} filter
- Returns:
- {Array}
- Parameters:
- {String} s
- String of an HTML tag that hosts a JSXGraph board
- Returns:
- {Object} Reference to the board or null.
Defined in: type.js.
- Parameters:
- {JXG.GeometryElement} el
- Element to be cloned
- Returns:
- Object Cloned element
Defined in: env.js.
- Parameters:
- {Array} cPos
- Previously determined position
- {Object} obj
- A DOM element
- Returns:
- {Array} The corrected position.
Defined in: env.js.
- Parameters:
- obj
- Returns:
- {Array} 3x3 transformation matrix without translation part. See JXG.Board#updateCSSTransforms.
Defined in: env.js.
- Parameters:
- {String|Object} elementId
- id of or reference to an HTML DOM node.
- doc
- Returns:
- {Object} An object with the two properties width and height.
Defined in: env.js.
- Parameters:
- evt
- {Event}
- Returns:
- {Number}
Defined in: env.js.
- Parameters:
- {Object} obj
- A DOM element
- Returns:
- {Array} An array with the elements left and top offset.
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.
Defined in: env.js.
- Parameters:
- {DOMElement} el
- {string} css
- Returns:
- {number}
- 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
- Parameters:
- board
- s
- Deprecated:
- Use JXG.Board#select.
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.
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
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
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.
Defined in: env.js.
- Returns:
- {Boolean}
Defined in: env.js.
- Returns:
- {Boolean}
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type array.
Defined in: type.js.
- Parameters:
- {Object} v
- Returns:
- {Boolean}
Defined in: env.js.
- Returns:
- {boolean}
Defined in: type.js.
- Parameters:
- v
- A variable of any type
Defined in: type.js.
- Parameters:
- v
- {Object|Array}
- Returns:
- {boolean} True, if v is an empty object or array.
Defined in: env.js.
- Returns:
- {Boolean}
Defined in: env.js.
- Parameters:
- evt
- {Event}
- Returns:
- {boolean}
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is a function.
Defined in: type.js.
- Parameters:
- {JXG.Board} board
- {String} s
- Returns:
- {Boolean}
Defined in: type.js.
- Parameters:
- {JXG.Board} board
- {String} s
- Returns:
- {Boolean}
Defined in: type.js.
- Parameters:
- {Array} arr
- val
- Returns:
- {Boolean}
Defined in: type.js.
- Parameters:
- {Object} obj
- val
- Returns:
- {Boolean}
Defined in: env.js.
- Returns:
- {Boolean}
Defined in: env.js.
- Returns:
- {boolean}
Defined in: env.js.
- Parameters:
- evt
- {Event}
- Returns:
- {Boolean}
Defined in: env.js.
- Returns:
- {Boolean}
Defined in: type.js.
- Parameters:
- {JXG.Board} board
- {String} s
- Returns:
- {Boolean}
Defined in: env.js.
- Returns:
- {Boolean}
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- {Boolean} acceptStringNumber Optional, Default: false
- If set to true, the function returns true for e.g. v='3.1415'.
- {Boolean} acceptNaN Optional, Default: true
- If set to false, the function returns false for v=NaN.
- Returns:
- {Boolean} True, if v is of type number.
Defined in: type.js.
- Parameters:
- v
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type JXG.Point.
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type JXG.Point3D.
Defined in: env.js.
- Parameters:
- evt
- {Event}
- Returns:
- {Boolean}
Defined in: type.js.
- Parameters:
- {JXG.Board} board
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type JXG.Point.
Defined in: type.js.
- Parameters:
- {JXG.Board} board
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type JXG.Point3D or an array of length at least 3, or a function returning such an array.
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type string.
Defined in: env.js.
- Returns:
- {Boolean} True, if the browser supports touch events.
Defined in: env.js.
- Parameters:
- evt
- {Event}
- Returns:
- {Boolean}
Defined in: type.js.
- Parameters:
- v
- A variable of any type.
- Returns:
- {Boolean} True, if v is of type JXG.Transformation.
Defined in: env.js.
- Returns:
- {Boolean}
Defined in: env.js.
- Returns:
- {Boolean}
Defined in: env.js.
- Returns:
- {Boolean}
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.
Defined in: type.js.
- Parameters:
- {Object} obj
- Returns:
- Object
- Examples:
var attr = JXG.keysToLowerCase({radiusPoint: {visible: false}});
// return {radiuspoint: {visible: false}}
Defined in: color.js.
- Parameters:
- {String} color
- {Number} percent
- Returns:
- {String}
- See:
- JXG.shadeColor
Defined in: color.js.
- Parameters:
- {Number} l
- {Number} m
- {Number} s
- Returns:
- {Array} Contains the r, g, and b value in this order.
In contrast to method JXG.mergeAttr, merge recurses into any kind of object, e.g. DOM object and JSXGraph objects.
So, please be careful.
Defined in: type.js.
- Parameters:
- {Object} obj1
- {Object} obj2
- Returns:
- {Object}
- See:
- JXG.mergeAttr
- Examples:
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'
}
});
In contrast to method JXG.merge, mergeAttr does not recurse into DOM objects and JSXGraph objects. Instead
handles (pointers) to these objects are used.
Defined in: type.js.
- Parameters:
- {Object} attr
- Object with attributes - usually containing default options - that will be changed in-place.
- {Object} special
- Special option values which overwrite (recursively) the default options
- {Boolean} toLower Optional, Default: true
- If true the keys are converted to lower case.
- {Boolean} ignoreUndefinedSpecials Optional, Default: false
- If true the values in special that are undefined are not used.
- See:
- JXG.merge
| Input | Output |
|---|---|
| cross | x |
| circle | o |
| square, [] | [] |
| plus | + |
| minus | - |
| divide | | |
| diamond | <> |
| triangleup | ^, a, A |
| triangledown | 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.
- '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
Defined in: type.js.
- Parameters:
- {String|Number} v
- {Number} percentOfWhat
- {Function|Number|*} convertPx
- Returns:
- {String|Number}
Defined in: type.js.
- Parameters:
- {String} str
- Returns:
- {Obj} { side, pos }
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.
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.
- 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.
- Parameters:
- {function} reader
- A file reader. This object has to provide two methods: prepareString() and read().
- {Array} ext
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.
Defined in: type.js.
- Parameters:
- {Array} ar
- el
- Returns:
- {Array}
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.
Defined in: color.js.
- Parameters:
- {String} color
- HTML string containing the HTML color code.
- Returns:
- {String} Returns a HTML color string
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
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
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
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. See https://www.had2know.org/technology/hsv-rgb-conversion-formula-calculator.html.
- {Number} ag
- {Number} ab
- Returns:
- {Array} Contains the h, s, and v value in this order.
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.
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.
Defined in: color.js.
- Parameters:
- {String|Array} rgb
- 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.
- {Number} o
- The desired opacity >=0, <=1.
- Returns:
- {String} The RGBA color value.
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.
Defined in: type.js.
- Parameters:
- {String} str
- {Boolean} caja
- Returns:
- {String} Sanitized string
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.
Defined in: color.js.
- Examples:
JXG.setClassicColors();
var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-5, 5, 5,-5]});
Defined in: color.js.
- Parameters:
- {String} color
- {Number} percent
- Returns:
- {String}
- 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.
This function is meanwhile superseded by stack_jxg.stack2jsxgraph.
Defined in: type.js.
- Parameters:
- {String} str
- Returns:
- String
- 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)" ]
Defined in: type.js.
- Parameters:
- {String} s
- String containing either true or false.
- Returns:
- {Boolean} String typed boolean value converted to boolean.
Defined in: env.js.
- Returns:
- {Boolean} True, if the browser supports HTML canvas.
Defined in: env.js.
Defined in: env.js.
- Returns:
- {Boolean}
Defined in: env.js.
- Returns:
- {Boolean} True, if the browser supports SVG.
Defined in: env.js.
- Returns:
- {Boolean} True, if the browser supports VML.
Defined in: type.js.
- Parameters:
- {Array} arr
- {Number} i
- {Number} j
- Returns:
- {Array} Reference to the given array.
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.
Defined in: type.js.
- Parameters:
- {Number} num
- Number tp be rounded
- {Number} digits
- Decimal digits
- Returns:
- {String} Rounded number is returned as string
Defined in: type.js.
- Parameters:
- {Number} x
- {Boolean} useTeX Optional, Default: false
- {Number} order Optional, Default: 0.001
- Returns:
- {String}
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.
Defined in: type.js.
- Parameters:
- {Array} arr
- {Array} arr
- Array of numbers
- {Number} eps
- Precision
- Returns:
- {Array}
- {Array}
- See:
- JXG.uniqueArray
- Examples:
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 ]
Defined in: type.js.
- Parameters:
- {String} str
- Returns:
- {String}
Defined in: type.js.
- Parameters:
- {String} str
- Returns:
- {String}
Defined in: type.js.
- Parameters:
- {Number} n
- {Number} p
- Returns:
- {Number}
Defined in: type.js.
- Parameters:
- {String} str
- Returns:
- {String}
Defined in: type.js.
- Parameters:
- {Array} arr
- Returns:
- {Array}
Defined in: options.js.
- Parameters:
- {JXG.Board} board
- The board to which objects the options will be applied.
Defined in: options.js.
- Parameters:
- {JXG.Board} board
- The board to which objects the options will be applied.
- Parameters:
- {String} warning
- The warning text