documentationfor yFiles for HTML 2.6

Non-Editable Graphs

Not every application needs to be a full-blown graph editor. Your application may just want to explore static graphs or graphs that are not created and modified interactively, but rather via code. GraphViewerInputMode is an easy way to just look at a graph, but not change it.

Setting GraphViewerInputMode as main input mode
graphComponent.inputMode = new GraphViewerInputMode()

GraphViewerInputMode can be useful in various circumstances:

  • You just have a static graph that is generated from external data, but it is large enough to warrant navigation features like zooming and panning.
  • Your graph is not static, but is created and updated through code, e.g. in response to external events, or as result of a layout algorithm.
  • Your graph can be edited only through a number of special features, like toolbar buttons, context menus, etc. but none of the default gestures provided by GraphEditorInputMode (which would necessitate turning off most of GraphEditorInputMode’s functionality).

In principle GraphViewerInputMode is very similar to GraphEditorInputMode, but lacks the functionality to change the structure of the graph interactively. By default it is configured with gestures that allow easy exploration of static graphs. However, core interaction features of GraphEditorInputMode that do not change the graph — such as selection, the ability to react to clicks on items, have context menus, or tooltips — are exactly the same in GraphViewerInputMode.