This defines a node template consisting of a top half and a bottom half. Each half's text and color are data bound. However the size of each node is fixed, so if the text is too long, it will be clipped.


{ "class": "go.GraphLinksModel",
  "nodeDataArray": [
    { "key": "Alpha", "topText": "A", "topColor": "lightgray", "bottomText": "B", "bottomColor": "green" },
    { "key": "Beta", "topText": "C", "bottomText": "D", "bottomColor": "red", "star": true }
  ],
  "linkDataArray": [
    { "from": "Alpha", "to": "Beta" }
  ]
}
  

GoJS Features in this sample

Geometry Path Strings

The GoJS Geometry class controls the "shape" of a Shape, whereas the Shape.fill and Shape.stroke and other shape properties control the colors and appearance of the shape. For common shape figures, there are predefined geometries that can be used by setting Shape.figure. However one can also define custom geometries.

One can construct any Geometry by allocating and initializing a Geometry of at least one PathFigure holding some PathSegments. But you may find that using the string representation of a Geometry is easier to write and save in a database. Use the static method Geometry.parse or the Shape.geometryString property to transform a geometry path string into a Geometry object.

More information can be found in the GoJS Intro.

Related samples