Members
Own
defs : Node
- Description
The
defselement is a container element to reference reusable SVG elements.- Type
- Node
- See
- Source
- renderer/svg.js, line 115
layer : Array
- Description
JSXGraph uses a layer system to sort the elements on the board. This puts certain types of elements in front of other types of elements. For the order used see JXG.Options.layer. The number of layers is documented there, too. The higher the number, the "more on top" are the elements on this layer.
- Type
- Array
- Source
- renderer/svg.js, line 314
svgNamespace : String
- Description
The SVG Namespace used in JSXGraph.
- Type
- String
- Default Value
- http://www.w3.org/2000/svg
- See
- Source
- renderer/svg.js, line 78
svgRoot : Node
- Description
SVG root node
- Type
- Node
- Source
- renderer/svg.js, line 70
xlinkNamespace : String
- Description
The xlink namespace. This is used for images.
- Type
- String
- Default Value
- http://www.w3.org/1999/xlink
- See
- Source
- renderer/svg.js, line 86
Inherited
Methods
Own
(private) _createArrowHead(el, idAppendixopt) → {Node}
Creates an arrow DOM node. Arrows are displayed in SVG with a marker tag.
Parameters
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
el |
JXG.GeometryElement | A JSXGraph element, preferably one that can have an arrow attached. |
||
idAppendix |
String |
<optional> |
''
|
A string that is added to the node's id. |
Returns
Reference to the node added to the DOM.
- Type
- Node
Details
- Source
- renderer/svg.js, line 361
(private) _getValuesOfDOMElements(node) → {Array}
Walk recursively through the DOM subtree of a node and collect all value attributes together with the id of that node. Attention: Only values of nodes having a valid id are taken.
Parameters
| Name | Type | Description |
|---|---|---|
node |
Node | root node of DOM subtree that will be searched recursively. |
Returns
Array with entries of the form [id, value]
- Type
- Array
Details
- Source
- renderer/svg.js, line 2085
_setArrowColor(node, color, opacity, el)
Updates color of an arrow DOM node.
Parameters
| Name | Type | Description |
|---|---|---|
node |
Node | The arrow node. |
color |
String | Color value in a HTML compatible format, e.g. |
opacity |
Number | |
el |
JXG.GeometryElement | The element the arrows are to be attached to |
Details
- Source
- renderer/svg.js, line 564
(private) _setAttribute(setFunc, testAttribute)
Call user-defined function to set visual attributes. If "testAttribute" is the empty string, the function is called immediately, otherwise it is called in a timeOut.
This is necessary to realize smooth transitions but avoid transitions when first creating the objects.
Usually, the string in testAttribute is the visPropOld attribute of the values which are set.
Parameters
| Name | Type | Description |
|---|---|---|
setFunc |
function | Some function which usually sets some attributes |
testAttribute |
String | If this string is the empty string the function is called immediately, otherwise it is called in a setImeout. |
Details
(private) createShadowFilter(id, rgb, opacity, blend, blur, offset)
Create an SVG shadow filter. If the object's RGB color is [r,g,b], it's opacity is op, and the parameter color is given as [r', g', b'] with opacity op' the shadow will have RGB color [blendr + r', blendg + g', blend*b + b'] and the opacity will be equal to op * op'. Further, blur and offset can be adjusted.
The shadow color is [r*ble
Parameters
| Name | Type | Description |
|---|---|---|
id |
String | Node is of the filter. |
rgb |
Array | String | RGB value for the blend color or the string 'none' for default values. Default 'black'. |
opacity |
Number | Value between 0 and 1, default is 1. |
blend |
Number | Value between 0 and 1, default is 0.1. |
blur |
Number | Default: 3 |
offset |
Array | [dx, dy]. Default is [5,5]. |
Returns
DOM node to be added to this.defs.
Details
- Source
- renderer/svg.js, line 139
dumpToCanvas(canvasId, w, h, ignoreTexts) → {Promise}
Convert the SVG construction into an HTML canvas image. This works for all SVG supporting browsers. Implemented as Promise.
Might fail if any text element or foreign object element contains SVG. This is the case e.g. for the default fullscreen symbol.
For IE, it is realized as function. It works from version 9, with the exception that HTML texts are ignored on IE. The drawing is done with a delay of 200 ms. Otherwise there would be problems with IE.
Examples
board.renderer.dumpToCanvas('canvas').then(function() { console.log('done'); });
// IE 11 example:
board.renderer.dumpToCanvas('canvas');
setTimeout(function() { console.log('done'); }, 400);
Parameters
| Name | Type | Description |
|---|---|---|
canvasId |
String | Id of an HTML canvas element |
w |
Number | Width in pixel of the dumped image, i.e. of the canvas tag. |
h |
Number | Height in pixel of the dumped image, i.e. of the canvas tag. |
ignoreTexts |
Boolean | If true, the foreignObject tag is taken out from the SVG root. This is necessary for older versions of Safari. Default: false |
Returns
Promise object
- Type
- Promise
Details
- Overrides
- JXG.AbstractRenderer#dumpToCanvas
- Source
- renderer/svg.js, line 2308
dumpToDataURI(ignoreTexts) → {String}
Return a data URI of the SVG code representing the construction. The SVG code of the construction is base64 encoded. The return string starts with "data:image/svg+xml;base64,...".
Example
var A = board.create('point', [2, 2]);
var txt = board.renderer.dumpToDataURI(false);
// txt consists of a string of the form
// data:image/svg+xml;base64,PHN2Zy. base64 encoded SVG..+PC9zdmc+
// Behind the comma, there is the base64 encoded SVG code
// which is decoded with atob().
// The call of decodeURIComponent(escape(...)) is necessary
// to handle unicode strings correctly.
var ar = txt.split(',');
document.getElementById('output').value = decodeURIComponent(escape(atob(ar[1])));
Parameters
| Name | Type | Description |
|---|---|---|
ignoreTexts |
Boolean | If true, the foreignObject tag is set to display=none. This is necessary for older versions of Safari. Default: false |
Returns
data URI string
- Type
- String
Details
- Overrides
- JXG.AbstractRenderer#dumpToDataURI
- Source
- renderer/svg.js, line 2200
screenshot(board, imgId, ignoreTexts) → {Object}
Display SVG image in html img-tag which enables easy download for the user.
Support:
- IE: No
- Edge: full
- Firefox: full
- Chrome: full
- Safari: full (No text support in versions prior to 12).
Parameters
| Name | Type | Description |
|---|---|---|
board |
JXG.Board | Link to the board. |
imgId |
String | Optional id of an img object. If given and different from the empty string, the screenshot is copied to this img object. The width and height will be set to the values of the JSXGraph container. |
ignoreTexts |
Boolean | If set to true, the foreignObject is taken out of the SVGRoot and texts are not displayed. This is mandatory for Safari. Default: false |
Returns
the svg renderer object
- Type
- Object
Details
- Overrides
- JXG.AbstractRenderer#screenshot
- Source
- renderer/svg.js, line 2393
(private) toStr(str)
Combine arguments to a string, joined by empty string. The container id needs to be escaped, as it may contain URI-unsafe characters
Example
this.toStr('aaa', '_', 'bbb', 'TriangleEnd')
// Output:
// xxx_bbbTriangleEnd
Parameters
| Name | Type | Description |
|---|---|---|
str |
String | variable number of strings |
Returns
String
Details
- See
- Source
- renderer/svg.js, line 220
(private) toURL(str)
Combine arguments to an URL string of the form url(#...) Masks the container id. Calls JXG.SVGRenderer#toStr.
Example
this.toURL('aaa', '_', 'bbb', 'TriangleEnd')
// Output:
// url(#xxx_bbbTriangleEnd)
Parameters
| Name | Type | Description |
|---|---|---|
str |
String | variable number of strings |
Returns
URL string
Details
- See
- Source
- renderer/svg.js, line 243
(private) uniqName(one) → {String}
Create a "unique" string id from the arguments of the function. Concatenate all arguments by "_". "Unique" is achieved by simply prepending the container id. Do not escape the string.
If the id is used in an "url()" call it must be eascaped.
Parameters
| Name | Type | Description |
|---|---|---|
one |
String | or strings which will be concatenated. |
Returns
- Type
- String
Details
- Source
- renderer/svg.js, line 202
updateClipPathRect(w, h)
Update the filter node which does the clipping of elements (beside HTML texts) outside of the SVG. It is called in procedure resize().
Parameters
| Name | Type | Description |
|---|---|---|
w |
Number | |
h |
Number |
Details
- See
- Source
- renderer/svg.js, line 293
(private) updateGradientAngle(node, radians)
Set the gradient angle for linear color gradients.
Parameters
| Name | Type | Description |
|---|---|---|
node |
SVGnode | SVG gradient node of an arbitrary JSXGraph element. |
radians |
Number | angle value in radians. 0 is horizontal from left to right, Pi/4 is vertical from top to bottom. |
Details
- Source
- renderer/svg.js, line 1911
(private) updateGradientCircle(node, cx, cy, r, fx, fy, fr)
Set circles for radial color gradients.
Parameters
| Name | Type | Description |
|---|---|---|
node |
SVGnode | SVG gradient node |
cx |
Number | SVG value cx (value between 0 and 1) |
cy |
Number | SVG value cy (value between 0 and 1) |
r |
Number | SVG value r (value between 0 and 1) |
fx |
Number | SVG value fx (value between 0 and 1) |
fy |
Number | SVG value fy (value between 0 and 1) |
fr |
Number | SVG value fr (value between 0 and 1) |
Details
- Source
- renderer/svg.js, line 1955
(private) updateInternalTextStyle()
Set color and opacity of internal texts.
Details
Inherited
Parameters
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
container |
Node | Reference to a DOM node containing the board. |
|||||||||
dim |
Object | The dimensions of the board Properties
|
Details
- See
- Source
- renderer/svg.js, line 56