Trail: Creating a Simple Graph Viewer

In this trail, we are going to create, step by step, a simple diagramming application that uses the yFiles for Java graph visualization library. The application will be a viewer type of application, i.e., a graph will only be displayed, there will be no support for interactively changing the graph. Navigation in the view will be supported (panning, i.e., moving the viewport) as well as zooming in and out.

Creating an Empty View — This lesson shows the most basic steps to create a yFiles view component.

A yFiles "Hello World!" Application — Enhances the application from the previous lesson component to host a graph which presents a well-known message, however provides no support for user interaction.

Changing the Default Rendering — Shows how to change the rendering of nodes.

Adding Zooming Toolbar Actions — Shows how to add a toolbar and actions for zooming.

Mouse-based Support for Zooming and Panning — Adds further support for mouse-based interaction to the view: panning using the mouse and mouse-wheel zooming.

Java Swing vs. Eclipse SWT

While this trail focusses on building a Java Swing application where the yFiles view component is added to, Using yFiles Viewer within Eclipse from the yWorks Knowledge Base explains how to embed a Graph2DView into an Eclipse-based SWT application.