documentationfor yFiles for HTML 2.6

EdgeCreator<TDataItem>

This class can be used to create and update IEdges based on data items.

Inheritance Hierarchy
EdgeCreator

Remarks

These data items can be any business or arbitrary data which should be represented by edges.

EdgeCreator<TDataItem> allows for conveniently binding properties of the data item to the properties of the created IEdge to control aspects like the styling.

This class can be used both standalone as well as in conjunction with any of the GraphBuilders, e.g. GraphBuilder.

In the context of the GraphBuilder, it is responsible to create the items from the associated EdgesSource<TDataItem>s.

Examples

An EdgeCreator<TDataItem> can either be used with an EdgesSource<TDataItem> in conjunction with a GraphBuilder

const builder = new GraphBuilder()
const edgeCreator = builder.createEdgesSource(
  edgeData,
  (item) => item.from,
  (item) => item.to
).edgeCreator
edgeCreator.defaults.shareStyleInstance = false
edgeCreator.defaults.style = new PolylineEdgeStyle()
edgeCreator.styleBindings.addBinding('stroke', (item) =>
  item.assistant ? 'darkred' : 'darkorange'
)

builder.buildGraph()

or it can be used standalone. In that case, its createEdge method can be used to create edges.

const edgeCreator = new EdgeCreator()
edgeCreator.defaults.shareStyleInstance = false
edgeCreator.defaults.style = new PolylineEdgeStyle()
edgeCreator.styleBindings.addBinding('stroke', (item) =>
  item.assistant ? 'darkred' : 'darkorange'
)

const edge = edgeCreator.createEdge(graph, sourceNode, targetNode, dataItem)const edgeCreator = new EdgeCreator<EdgeData>()
edgeCreator.defaults.shareStyleInstance = false
edgeCreator.defaults.style = new PolylineEdgeStyle()
edgeCreator.styleBindings.addBinding('stroke', (item) =>
  item.assistant ? 'darkred' : 'darkorange'
)

const edge = edgeCreator.createEdge(graph, sourceNode, targetNode, dataItem)

Type Parameters

TDataItem
The type of the data items in the source.

Type Details

yfiles module
view-component
yfiles-umd modules
All view modules
Legacy UMD name
yfiles.binding.EdgeCreator

See Also

Constructors

Properties

Methods

Events