JXG.JSXGraph

Class

The JXG.JSXGraph singleton stores all properties required to load, store, create and free a board.

Members

Own

(static) rendererType : String

Description

Stores the renderer that is used to draw the boards.

Type
String
Source
jsxgraph.js, line 64

Inherited

none

Methods

Own

(private, static) _fillBoard(board, attr, dimensions)

Further initialization of the board, e.g. set some attributes.

Parameters

Name Type Description
board JXG.Board
attr Object

attributes object

dimensions Object

Object containing dimensions of the canvas

Details

Source
jsxgraph.js, line 222

(private, static) _removeARIANodes(board)

Remove the two corresponding ARIA divs when freeing a board

Parameters

Name Type Description
board JXG.Board

Details

Source
jsxgraph.js, line 272

(private, static) _setARIA(container, attr)

Parameters

Name Type Description
container String | Object

id of or reference to the HTML element in which the board is painted.

attr Object

An object that sets some of the board attributes.

Details

Source
jsxgraph.js, line 239

(private, static) _setAttributes(attributes) → {Object}

Merge the user supplied attributes with the attributes in options.js

Parameters

Name Type Description
attributes Object

User supplied attributes

Returns

Merged attributes for the board

Type
Object

Details

Source
jsxgraph.js, line 184

(static) freeBoard(board)

Delete a board and all its contents.

Parameters

Name Type Description
board JXG.Board | String

id of or reference to the DOM element in which the board is drawn.

Details

Source
jsxgraph.js, line 757

(static) initBoard(box, attributes) → {JXG.Board}

Initialize a new 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
            }
        }
    }
});

Parameters

Name Type Description
box String | Object

id of or reference to the HTML element in which the board is painted.

attributes Object

An object that sets some of the board attributes. See JXG.Board for a list of available attributes of the board. Most of these attributes can also be set via JXG.Options,

Returns

Reference to the created board.

Type
JXG.Board

Details

See
Source
jsxgraph.js, line 501

(private, static) initRenderer(box, dim, doc, attrRenderer) → {Object}

Initialize the rendering engine

Parameters

Name Type Description
box String

id of or reference to the div element which hosts the JSXGraph construction

dim Object

The dimensions of the board

doc Object

Usually, this is document object of the browser window. If false or null, this defaults to the document object of the browser.

attrRenderer Object

Attribute 'renderer', specifies the rendering engine. Possible values are 'auto', 'svg', 'canvas', 'no', and 'vml'.

Returns

Reference to the rendering engine object.

Type
Object

Details

Source
jsxgraph.js, line 127

(static) loadBoardFromFile(box, file, format, attributes, callback) → {JXG.Board}

Load a board from a file containing a construction made with either GEONExT, Intergeo, Geogebra, or Cinderella.

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"); }
);

Parameters

Name Type Description
box String | Object

id of or reference to the HTML element in which the board is painted.

file String

base64 encoded string.

format String

containing the file format: 'Geonext' or 'Intergeo'.

attributes Object

Attributes for the board and 'encoding'. Compressed files need encoding 'iso-8859-1'. Otherwise it probably is 'utf-8'.

callback function

Returns

Reference to the created board.

Type
JXG.Board

Details

See
  • JXG.FileReader
  • JXG.GeonextReader
  • JXG.GeogebraReader
  • JXG.IntergeoReader
  • JXG.CinderellaReader
Source
jsxgraph.js, line 675

(static) loadBoardFromString(box, string, format, attributes, callback) → {JXG.Board}

Load a board from a base64 encoded string containing a construction made with either GEONExT, Intergeo, Geogebra, or Cinderella.

Parameters

Name Type Description
box String | Object

id of or reference to the HTML element in which the board is painted.

string String

base64 encoded string.

format String

containing the file format: 'Geonext', 'Intergeo', 'Geogebra'.

attributes Object

Attributes for the board and 'encoding'. Compressed files need encoding 'iso-8859-1'. Otherwise it probably is 'utf-8'.

callback function

Returns

Reference to the created board.

Type
JXG.Board

Details

See
  • JXG.FileReader
  • JXG.GeonextReader
  • JXG.GeogebraReader
  • JXG.IntergeoReader
  • JXG.CinderellaReader
Source
jsxgraph.js, line 722

(static) registerElement(element, creator)

Parameters

Name Type Description
element
creator

Details

Deprecated
Use JXG#registerElement
Source
jsxgraph.js, line 803

Inherited

none

Details

Source
jsxgraph.js, line 59