Element Grid
JXG.GeometryElement
↳ JXG.Curve
↳ Grid
Creates a grid to support the user with element placement or to improve determination of position.
Defined in: grid.js.
Extends
JXG.Curve.
Constructor Attributes | Constructor Name and Description |
---|---|
A grid is a set of vertical and horizontal lines or other geometrical objects (faces)
to support the user with element placement or to improve determination of position.
|
Field Attributes | Field Name and Description |
---|---|
This attribute determines whether the grid elements located at x=0, y=0
and (for major grid only) at (0, 0) are displayed.
|
|
Appearance of grid elements.
|
|
To print a quadratic grid with same distance of major grid elements in x- and y-direction.
|
|
Deprecated.
|
|
Deprecated.
|
|
To decide whether major or minor grid elements on boundaries of the boundingBox shall be shown, half-ones as well.
|
|
This object contains the attributes for major grid elements.
|
|
Distance of major grid elements.
|
|
This number (pixel value) controls where grid elements end at the canvas edge.
|
|
This object contains the attributes for minor grid elements.
|
|
Number of elements in minor grid between elements of the major grid.
|
|
Number of vertices for face 'polygon'.
|
|
Size of grid elements.
|
|
<private> |
Array of theme attributes.
|
- Methods borrowed from class JXG.Curve:
- addTransform, allocatePoints, generateTerm, getTransformationSource, hasPoint, interpolationFunctionFromArray, maxX, minX, moveTo, notifyParents, update, updateCurve, updateDataArray, updateRenderer, updateTransform, X, Y, Z
- Methods borrowed from class JXG.GeometryElement:
- _set, addChild, addDescendants, addParents, addParentsFromJCFunctions, addRotation, addTicks, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, eval, evalVisProp, formatNumberLocale, fullUpdate, generatePolynomial, getAttribute, getAttributes, getLabelAnchor, getName, getParents, getProperty, getSnapSizes, getTextAnchor, getType, handleSnapToGrid, hide, hideElement, noHighlight, normalize, prepareUpdate, remove, removeAllTicks, removeChild, removeDescendants, removeTicks, resolveShortcuts, setArrow, setAttribute, setDash, setDisplayRendNode, setLabel, setLabelText, setName, setParents, setPosition, setPositionDirectly, setProperty, show, showElement, snapToPoints, updateVisibility, useLocale
- Events borrowed from class JXG.GeometryElement:
- attribute, attribute:key, down, drag, keydrag, mousedown, mousedrag, mousemove, mouseout, mouseover, mouseup, move, out, over, pendown, pendrag, penup, touchdown, touchdrag, touchup, up
-
This element has no direct constructor. To create an instance of this element you have to call JXG.Board#create
with type "grid".
- Possible parent array combinations are:
-
{JXG.Axis} a1
{JXG.Axis} a2
- Optional parent axis.
- Throws:
- {Error}
- If the element cannot be constructed with the given parent objects an exception is thrown.
- Examples:
// standard grid var g = board.create('grid', [], {});
// more fancy grid var g = board.create('grid', [], { major: { face: 'plus', size: 7, strokeColor: 'green', strokeOpacity: 1, }, minor: { size: 4 }, minorElements: 3, });
// extreme fancy grid var grid = board.create('grid', [], { major: { face: 'regularPolygon', size: 8, strokeColor: 'blue', fillColor: 'orange', strokeOpacity: 1, }, minor: { face: 'diamond', size: 4, strokeColor: 'green', fillColor: 'grey', }, minorElements: 1, includeBoundaries: false, });
// grid with parent axes var axis1 = board.create('axis', [[-1, -2.5], [1, -2.5]], { ticks: { strokeColor: 'green', strokeWidth: 2, minorticks: 2, majorHeight: 10, drawZero: true } }); var axis2 = board.create('axis', [[3, 0], [3, 2]], { ticks: { strokeColor: 'red', strokeWidth: 2, minorticks: 3, majorHeight: 10, drawZero: true } }); var grid = board.create('grid', [axis1, axis2], { major: { face: 'line' }, minor: { face: 'point', size: 3 }, minorElements: 'auto', includeBoundaries: false, });
- If false, then all these elements are hidden.
- If true, all these elements are shown.
- If an object of the following form is given, the three cases can be distinguished individually:
{x: true|false, y: true|false, origin: true|false}
This attribute can be set individually for major and minor grid as a sub-entry of Grid#major or Grid#minor, e.g. major: {drawZero: ...} For default values have a look there.
Defined in: options.js.
Input | Output | Fillable by fillColor,... |
---|---|---|
point, . | . | no |
line | − | no |
cross, x | x | no |
circle, o | o | yes |
square, [] | [] | yes |
plus, + | + | no |
minus, - | - | no |
divide, | | | | no |
diamond, <> | <> | yes |
diamond2, <<>> | <> (bigger) | yes |
triangleup, ^, a, A | ^ | no |
triangledown, v | v | no |
triangleleft, < | < | no |
triangleright, > | > | no |
regularPolygon, regpol | ⬡ | yes |
This attribute can be set individually for major and minor grid as a sub-entry of Grid#major or Grid#minor, e.g. major: {face: ...} For default values have a look there.
Defined in: options.js.
Defined in: options.js.
- Default Value:
- false
- Default Value:
- null
- Default Value:
- null
Defined in: options.js.
- Default Value:
- false
{ size: 5, face: 'line', margin: 0, drawZero: true, polygonVertices: 6 }
Defined in: options.js.
- If it is set to 'auto' the distance of the major grid equals the distance of majorTicks of the corresponding axis.
- Numbers or strings which are numbers (e.g. '10') are interpreted as distance in usrCoords.
- Strings with the unit 'px' are interpreted as distance in screen pixels.
- Strings with the unit '%' or 'fr' are interpreted as a ratio to the width/height of the board. (e.g. 50% = 0.5fr)
Defined in: options.js.
- Default Value:
- 'auto'
This attribute can be set individually for major and minor grid as a sub-entry of Grid#major or Grid#minor, e.g. major: {margin: ...} For default values have a look there.
Defined in: options.js.
{ size: 3, face: 'point', margin: 0, drawZero: true, polygonVertices: 6 }
Defined in: options.js.
- If set to 'auto', the number minor elements is equal to the number of minorTicks of the corresponding axis.
- Numbers or strings which are numbers (e.g. '10') are interpreted as quantity.
Defined in: options.js.
- Default Value:
- 0
This attribute can be set individually for major and minor grid as a sub-entry of Grid#major or Grid#minor, e.g. major: {polygonVertices: ...} For default values have a look there.
Defined in: options.js.
- Numbers or strings which are numbers (e.g. '10') are interpreted as size in pixels.
- Strings with additional '%' (e.g. '95%') are interpreted as the ratio of used space for one element.
This attribute can be set individually for major and minor grid as a sub-entry of Grid#major or Grid#minor, e.g. major: {size: ...} For default values have a look there.
Defined in: options.js.
Defined in: options.js.
// Theme 1 // quadratic grid appearance with distance of major grid elements set to the primarily greater one JXG.JSXGraph.initBoard('jxgbox', { boundingbox: [-4, 4, 4, -4], axis: true, defaultAxes: { x: { ticks: {majorHeight: 10} }, y: { ticks: {majorHeight: 10} } }, grid: { theme: 1 }, });
// Theme 2 // lines and points in between JXG.JSXGraph.initBoard('jxgbox', { boundingbox: [-4, 4, 4, -4], axis: false, grid: { theme: 2 }, });
// Theme 3 // lines and thinner lines in between JXG.JSXGraph.initBoard('jxgbox', { boundingbox: [-4, 4, 4, -4], axis: false, grid: { theme: 3 }, });
// Theme 4 // lines with grid of '+'s plotted in between JXG.JSXGraph.initBoard('jxgbox', { boundingbox: [-4, 4, 4, -4], axis: false, grid: { theme: 4 }, });
// Theme 5 // grid of '+'s and points in between JXG.JSXGraph.initBoard('jxgbox', { boundingbox: [-4, 4, 4, -4], axis: false, grid: { theme: 5 }, });
// Theme 6 // grid of circles with points in between JXG.JSXGraph.initBoard('jxgbox', { boundingbox: [-4, 4, 4, -4], axis: false, grid: { theme: 6 }, });
- Attributes borrowed from class JXG.Curve:
- lineCap
- Attributes borrowed from class JXG.GeometryElement:
- aria, cssClass, dash, dashScale, draft, dragToTopOfLayer, element3D, fillColor, fillOpacity, fixed, frozen, gradient, gradientAngle, gradientCX, gradientCY, gradientEndOffset, gradientFR, gradientFX, gradientFY, gradientR, gradientSecondColor, gradientSecondOpacity, gradientStartOffset, highlight, highlightCssClass, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, isLabel, layer, needsRegularUpdate, nonnegativeOnly, precision, priv, rotatable, scalable, shadow, snapToGrid, strokeColor, strokeOpacity, strokeWidth, tabindex, trace, traceAttributes, transitionDuration, transitionProperties, visible, withLabel
- Fields borrowed from class JXG.Curve:
- dataX, dataY, numberPoints, qdt, ticks
- Fields borrowed from class JXG.GeometryElement:
- _org_type, _pos, ancestors, baseElement, board, childElements, descendants, dump, elementClass, elType, hasLabel, highlighted, id, inherits, isDraggable, isReal, lastDragTime, methodMap, mouseover, name, needsUpdate, notExistingParents, numTraces, parents, quadraticform, rendNode, stdform, subs, symbolic, traces, transformations, type, visProp, visPropCalc
- Methods borrowed from class JXG.Curve:
- addTransform, allocatePoints, generateTerm, getTransformationSource, hasPoint, interpolationFunctionFromArray, maxX, minX, moveTo, notifyParents, update, updateCurve, updateDataArray, updateRenderer, updateTransform, X, Y, Z
- Methods borrowed from class JXG.GeometryElement:
- _set, addChild, addDescendants, addParents, addParentsFromJCFunctions, addRotation, addTicks, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, eval, evalVisProp, formatNumberLocale, fullUpdate, generatePolynomial, getAttribute, getAttributes, getLabelAnchor, getName, getParents, getProperty, getSnapSizes, getTextAnchor, getType, handleSnapToGrid, hide, hideElement, noHighlight, normalize, prepareUpdate, remove, removeAllTicks, removeChild, removeDescendants, removeTicks, resolveShortcuts, setArrow, setAttribute, setDash, setDisplayRendNode, setLabel, setLabelText, setName, setParents, setPosition, setPositionDirectly, setProperty, show, showElement, snapToPoints, updateVisibility, useLocale