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. Most of these properties can be set via JXG.Options.
- {Array} attributes.boundingbox Optional, Default: [-5, 5, 5, -5]
- An array containing four numbers describing the left, top, right and bottom boundary of the board in user coordinates
- {Boolean} attributes.keepaspectratio Optional, Default: false
- If true, the bounding box is adjusted to the same aspect ratio as the aspect ratio of the div containing the board.
- {Boolean} attributes.showCopyright Optional, Default: false
- Show the copyright string in the top left corner.
- {Boolean} attributes.showNavigation Optional, Default: false
- Show the navigation buttons in the bottom right corner.
- {Object} attributes.zoom Optional
- Allow the user to zoom with the mouse wheel or the two-fingers-zoom gesture.
- {Object} attributes.pan Optional
- Allow the user to pan with shift+drag mouse or two-fingers-pan gesture.
- {Object} attributes.drag Optional
- Allow the user to drag objects with a pointer device.
- {Object} attributes.keyboard Optional
- Allow the user to drag objects with arrow keys on keyboard.
- {Boolean} attributes.axis Optional, Default: false
- If set to true, show the axis. Can also be set to an object that is given to both axes as an attribute object.
- {Boolean|Object} attributes.grid Optional
- If set to true, shows the grid. Can also be set to an object that is given to the grid as its attribute object.
- {Boolean} attributes.registerEvents Optional, Default: true
- Register mouse / touch events.
- Returns:
- {JXG.Board} Reference to the created board.
<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