Templates
Los templates definen cómo se renderiza cada nodo, enlace o grupo. Se construyen
con GraphObject.make (el atajo $) y pueden usar bindings para leer datos
del modelo.
Estructura de un template
Section titled “Estructura de un template”Un template de nodo es un Panel (aquí de tipo Auto) con hijos:
go.Shape— la forma (fill, stroke, tamaño mínimo).go.TextBlock— la etiqueta, enlazada a una propiedad del dato.
Bindings
Section titled “Bindings”new go.Binding('text', 'name') enlaza data.name a la propiedad text del
TextBlock. Al cambiar el modelo, la etiqueta se actualiza automáticamente.
Part-level properties
Section titled “Part-level properties”Propiedades como background, width, height o scale en el mapa de props
del template se aplican al Part (no al Panel), igual que en GoJS.
Enlaces
Section titled “Enlaces”Un template de enlace suele tener:
- Un
Shapeque dibuja la línea. - Un
ShapecontoArrowpara la flecha.