Class JXG.JSXGraph
↳ JXG.JSXGraph
The JXG.JSXGraph singleton stores all properties required
to load, save, create and free a board.
Defined in: jsxgraph.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Constructs a new JSXGraph singleton object.
|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
JXG.JSXGraph.rendererType
Stores the renderer that is used to draw the boards.
|
| Method Attributes | Method Name and Description |
|---|---|
| <private> <static> |
JXG.JSXGraph._fillBoard(board, attr, dimensions)
Further initialization of the board.
|
| <private> <static> |
JXG.JSXGraph._removeARIANodes(board)
Remove the two corresponding ARIA divs when freeing a board
|
| <private> <static> |
JXG.JSXGraph._setARIA(container, attr)
|
| <private> <static> |
JXG.JSXGraph._setAttributes(attributes, options)
Merge the user supplied attributes with the attributes in options.js
|
| <static> |
JXG.JSXGraph.freeBoard(board)
Delete a board and all its contents.
|
| <static> |
JXG.JSXGraph.initBoard(box, attributes)
Initialize a new board.
|
| <private> <static> |
JXG.JSXGraph.initRenderer(box, dim, doc, attrRenderer)
Initialize the rendering engine
|
| <static> |
JXG.JSXGraph.loadBoardFromFile(box, file, format, attributes, callback)
Load a board from a file containing a construction made with either GEONExT,
Intergeo, Geogebra, or Cinderella.
|
| <static> |
JXG.JSXGraph.loadBoardFromString(box, string, format, attributes, callback)
Load a board from a base64 encoded string containing a construction made with either GEONExT,
Intergeo, Geogebra, or Cinderella.
|
| <static> <deprecated> |
JXG.JSXGraph.registerElement(element, creator)
|
Field Detail
<static>
{String}
JXG.JSXGraph.rendererType
Stores the renderer that is used to draw the boards.
Method Detail
<private> <static>
JXG.JSXGraph._fillBoard(board, attr, dimensions)
Further initialization of the board. Set some properties from attribute values.
- Parameters:
- {JXG.Board} board
- {Object} attr
- attributes object
- {Object} dimensions
- Object containing dimensions of the canvas
<private> <static>
JXG.JSXGraph._removeARIANodes(board)
Remove the two corresponding ARIA divs when freeing a board
- Parameters:
- {JXG.Board} board
<private> <static>
JXG.JSXGraph._setARIA(container, attr)
- Parameters:
- {String|Object} container
- id of or reference to the HTML element in which the board is painted.
- {Object} attr
- An object that sets some of the board properties.
<private> <static>
{Object}
JXG.JSXGraph._setAttributes(attributes, options)
Merge the user supplied attributes with the attributes in options.js
- Parameters:
- {Object} attributes
- User supplied attributes
- options
- Returns:
- {Object} Merged attributes for the board
<static>
JXG.JSXGraph.freeBoard(board)
Delete a board and all its contents.
- Parameters:
- {JXG.Board|String} board
- id of or reference to the DOM element in which the board is drawn.
<static>
{JXG.Board}
JXG.JSXGraph.initBoard(box, attributes)
Initialize a new board.
- 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 via JXG.Options,
- Returns:
- {JXG.Board} Reference to the created board.
- Examples:
var board = JXG.JSXGraph.initBoard('jxgbox', {
boundingbox: [-10, 5, 10, -5],
keepaspectratio: false,
axis: true
});
const board = JXG.JSXGraph.initBoard('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.JSXGraph.initBoard('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
}
}
}
});
<private> <static>
{Object}
JXG.JSXGraph.initRenderer(box, dim, doc, attrRenderer)
Initialize the rendering engine
- Parameters:
- {String} box
- id of or reference to the div element which hosts the JSXGraph construction
- {Object} dim
- The dimensions of the board
- {Object} doc
- Usually, this is document object of the browser window. If false or null, this defaults to the document object of the browser.
- {Object} attrRenderer
- Attribute 'renderer', specifies the rendering engine. Possible values are 'auto', 'svg', 'canvas', 'no', and 'vml'.
- Returns:
- {Object} Reference to the rendering engine object.
<static>
{JXG.Board}
JXG.JSXGraph.loadBoardFromFile(box, file, format, attributes, callback)
Load a board from a file containing a construction made with either GEONExT,
Intergeo, Geogebra, or Cinderella.
- Parameters:
- {String|Object} box
- id of or reference to the HTML element in which the board is painted.
- {String} file
- base64 encoded string.
- {String} format
- containing the file format: 'Geonext' or 'Intergeo'.
- {Object} attributes
- Attributes for the board and 'encoding'. Compressed files need encoding 'iso-8859-1'. Otherwise it probably is 'utf-8'.
- {Function} callback
- Returns:
- {JXG.Board} Reference to the created board.
- See:
- JXG.FileReader
- JXG.GeonextReader
- JXG.GeogebraReader
- JXG.IntergeoReader
- JXG.CinderellaReader
- Examples:
// Uncompressed file
var board = JXG.JSXGraph.loadBoardFromFile('jxgbox', 'filename', 'geonext',
{encoding: 'utf-8'},
function (board) { console.log("Done loading"); }
);
// Compressed file
var board = JXG.JSXGraph.loadBoardFromFile('jxgbox', 'filename', 'geonext',
{encoding: 'iso-8859-1'},
function (board) { console.log("Done loading"); }
);
// From
var file = document.getElementById('localfile').files[0];
JXG.JSXGraph.loadBoardFromFile('jxgbox', file, 'geonext',
{encoding: 'utf-8'},
function (board) { console.log("Done loading"); }
);
<static>
{JXG.Board}
JXG.JSXGraph.loadBoardFromString(box, string, format, attributes, callback)
Load a board from a base64 encoded string containing a construction made with either GEONExT,
Intergeo, Geogebra, or Cinderella.
- Parameters:
- {String|Object} box
- id of or reference to the HTML element in which the board is painted.
- {String} string
- base64 encoded string.
- {String} format
- containing the file format: 'Geonext', 'Intergeo', 'Geogebra'.
- {Object} attributes
- Attributes for the board and 'encoding'. Compressed files need encoding 'iso-8859-1'. Otherwise it probably is 'utf-8'.
- {Function} callback
- Returns:
- {JXG.Board} Reference to the created board.
- See:
- JXG.FileReader
- JXG.GeonextReader
- JXG.GeogebraReader
- JXG.IntergeoReader
- JXG.CinderellaReader
<static>
JXG.JSXGraph.registerElement(element, creator)
- Parameters:
- element
- creator
- Deprecated:
- Use JXG#registerElement