Grid.elt() method

I need help understanding the grid.elt() method.

The documentation is lacking in this area. What does each of the objects in the elt list below refer to specifically?

diagram.grid.elt(0);
diagram.grid.elt(1);
diagram.grid.elt(2);
diagram.grid.elt(2);
diagram.grid.elt(3);

Thank you.

You are talking about the Panel.elt method, Panel | GoJS API.

You are also talking about the “Grid” type of Panel. Read more at GoJS Grid Patterns -- Northwoods Software.

The default value for Diagram.grid is defined as:

    // make the background Grid Panel
    var grid = new go.Panel(go.Panel.Grid);
    grid.name = 'GRID';

    var hlines = new go.Shape();
    hlines.figure = 'LineH';
    hlines.stroke = 'lightgray';
    hlines.strokeWidth = 0.5;
    hlines.interval = 1;
    grid.add(hlines);

    hlines = new go.Shape();
    hlines.figure = 'LineH';
    hlines.stroke = 'gray';
    hlines.strokeWidth = 0.5;
    hlines.interval = 5;
    grid.add(hlines);

    hlines = new go.Shape();
    hlines.figure = 'LineH';
    hlines.stroke = 'gray';
    hlines.strokeWidth = 1;
    hlines.interval = 10;
    grid.add(hlines);

    var vlines = new go.Shape();
    vlines.figure = 'LineV';
    vlines.stroke = 'lightgray';
    vlines.strokeWidth = 0.5;
    vlines.interval = 1;
    grid.add(vlines);

    vlines = new go.Shape();
    vlines.figure = 'LineV';
    vlines.stroke = 'gray';
    vlines.strokeWidth = 0.5;
    vlines.interval = 5;
    grid.add(vlines);

    vlines = new go.Shape();
    vlines.figure = 'LineV';
    vlines.stroke = 'gray';
    vlines.strokeWidth = 1;
    vlines.interval = 10;
    grid.add(vlines);

    myDiagram.grid = grid;

Thank you. That was very helpful.

We are adding a new file, extensions/Templates.js, in version 1.7 that provides the implementations of all of the predefined Diagram templates and selection adornment templates, as well as the definition of the Diagram.grid.