Grid shape options object that extends OBJ_Generic (without drawType) and OBJ_FigurePrimitive
drawType
A grid is a rectangle divided into a series of vertical and horizontal lines.
The rectangle is defined by bounds.
bounds
xNum and yNum can be used to defined a number of equally spaced lines in the rectangle (including the edges).
xNum
yNum
Alternatively xStep and yStep can be used to define the spacing between lines from the bottom left corner.
xStep
yStep
The line width and style is defined with line.
line
To test examples, append them to the boilerplate
// Grid defined by xStep and yStepfigure.add({ name: 'g', make: 'grid', bounds: [-0.5, -0.5, 1, 1], xStep: 0.25, yStep: 0.25, line: { width: 0.03, },}); Copy
// Grid defined by xStep and yStepfigure.add({ name: 'g', make: 'grid', bounds: [-0.5, -0.5, 1, 1], xStep: 0.25, yStep: 0.25, line: { width: 0.03, },});
// Grid defined by xNum and yNum with dashed linesconst grid = figure.primitives.grid({ bounds: [-0.5, -0.5, 1, 1], xNum: 4, yNum: 4, line: { width: 0.03, dash: [0.1, 0.02], },});figure.elements.add('g', grid); Copy
// Grid defined by xNum and yNum with dashed linesconst grid = figure.primitives.grid({ bounds: [-0.5, -0.5, 1, 1], xNum: 4, yNum: 4, line: { width: 0.03, dash: [0.1, 0.02], },});figure.elements.add('g', grid);
// Grid of gridsfigure.add({ name: 'g', make: 'grid', bounds: [-0.7, -0.7, 0.6, 0.6], xNum: 4, yNum: 4, line: { width: 0.03, }, copy: [ { along: 'x', num: 1, step: 0.8}, { along: 'y', num: 1, step: 0.8}, ],});@interface Copy
// Grid of gridsfigure.add({ name: 'g', make: 'grid', bounds: [-0.7, -0.7, 0.6, 0.6], xNum: 4, yNum: 4, line: { width: 0.03, }, copy: [ { along: 'x', num: 1, step: 0.8}, { along: 'y', num: 1, step: 0.8}, ],});@interface
Grid shape options object that extends OBJ_Generic (without
drawType) and OBJ_FigurePrimitiveA grid is a rectangle divided into a series of vertical and horizontal lines.
The rectangle is defined by
bounds.xNumandyNumcan be used to defined a number of equally spaced lines in the rectangle (including the edges).Alternatively
xStepandyStepcan be used to define the spacing between lines from the bottom left corner.The line width and style is defined with
line.See
To test examples, append them to the boilerplate
Example
Example
Example