Gridlines
extends Path
The Gridlines class represents a set of grid lines for a visual encoding. To create a Gridlines object, use the gridlines method in the Scene class, for example:
let gridlines = scene.gridlines("x", "metric");
Properties
| property | explanation | type | default value |
|---|---|---|---|
attribute ![]() | the data attribute represented by the grid lines | String | |
channel ![]() | the visual channel of the grid lines possible values include “x”, “y”, “width”, “height”, and “radialDistance” | String | |
elements ![]() | the elements used to construct the grid lines | Array | |
id ![]() | the unique id of the gridlines | String | |
| lines | the individual grid line definitions used to render the guide | Array | [] |
scale ![]() | the scale used to compute the grid line positions | Scale | |
type ![]() | the type of the gridlines | String | “gridlines” |
| values | the data values represented by the grid lines if not provided, Mascot will auto-generate values | Array |
Properties inherited from Path
| property | explanation | type | default value |
|---|---|---|---|
bounds ![]() | the bounding rectangle of the gridlines | Rectangle | |
| fillColor | the fill color of the gridlines path | Color | “none” |
| opacity | the opacity value of the gridlines (between 0 and 1) | Number | 0.5 |
| strokeColor | the stroke color of the gridlines | Color | “#ddd” |
| strokeDash | the dashes and gaps for the gridlines stroke | String | “none” |
| strokeWidth | the stroke width of the gridlines in pixels | Number | 1 |
x ![]() | the x coordinate of the center of the gridlines bounds | Number | |
y ![]() | the y coordinate of the center of the gridlines bounds | Number |
Methods
| method | explanation | return type |
|---|---|---|
| getSVGPathData() | returns a string to be used as the d parameter in an SVG path element | String |
