This document describes the resources available from the yFiles AJAX web application. In other words it documents the web application interface of the server side of yFiles AJAX.
This document was created from a WADL description using the wadl_documentation.xsl XSL stylesheet by Mark Nottingham ( http://www.mnot.net/ ) used under the terms of the Creative Commons Attribution-ShareAlike 2.5 License.
The resource returned for this request is a graph tile. A graph tile is an image of a part of the graph. The image is a quadratic PNG. Its magnification with respect to the world coordinates of the graph is controlled by the zoom factor. For a fixed graph and a fixed zoom factor, all tiles form a grid covering the plane containing the graph. One of those tiles is specified by its column and row.
parameter | value | description |
---|---|---|
zoom |
double(required) |
the zoom factor, strictly greater than 0, 1.0 is the "original" size of the graph |
col |
integer(required) |
the colum of the image, the left edge of the image corresponds to col*size/zoom in world coordinates |
row |
integer(required) |
the row of the image, the upper edge of the image corresponds to row*size/zoom in world coordinates |
size |
integer(required) |
the size of the image (width and height) in pixels |
path |
string(required) |
the name of the graph, which is shown on the image |
paintDetailThreshold |
The threshold for the zoom level at which the rendering should change from detailed to sloppy painting (if the zoom factor is lower than the threshold) or from sloppy to detailed painting (if the zoom factor is higher than the threshold). |
The resource returned for this request is the graph as an SVG image.
parameter | value | description |
---|---|---|
zoom |
double(required) |
the zoom factor, strictly greater than 0, 1.0 is the "original" size of the graph |
prefix |
the prefix that should be put before all generated ID values so that multiple graphs can be displayed on a single page. |
|
border |
A border that should be added to all sides of the generated SVG image. Useful when used with NodeRealizers that have drop shadows but don't include them in their size calculations. |
|
paintDetailThreshold |
The threshold for the zoom level at which the rendering should change from detailed to sloppy painting (if the zoom factor is lower than the threshold) or from sloppy to detailed painting (if the zoom factor is higher than the threshold). |
|
path |
string(required) |
the name of the graph, which is shown on the image |
the world and content bounds as an enclosing rectangle for a given graph in prefixed JSON format
{}&&{"x":100,"y":50,"width":200,"height":100,"contentBounds":{"x":100,"y":50,"width":200,"height":100}}
parameter | value | description |
---|---|---|
path |
string(required) |
the name of the graph |
hit test information for a given graph and a given axis-parallel query rectangle in prefixed JSON format
{}&&[ {"t":"e","i":"e-27","p":[{"x":407.0,"y":-297.0},{"x":417.0,"y":-297.0},{"x":437.0,"y":-317.0},{"x":452.0,"y":-317.0}]},
{"t":"nl","i":"nl-6-41","p":0,"x":443.0,"y":-384.0,"w":76.0,"h":19.0},
{"t":"n","i":"n-6","x":452.0,"y":-361.0,"w":57.0,"h":58.0,"u":"http://imdb.com/title/tt0473358/","d":"In the future... one man WILL make a difference"},
{"t":"nl","i":"nl-5-42","p":0,"x":352.0,"y":-350.0,"w":52.0,"h":19.0},
{"t":"n","i":"n-5","x":350.0,"y":-326.0,"w":57.0,"h":58.0,"u":"http://imdb.com/title/tt0379786/","d":"The crew of the Serenity is getting desperate. They have lain lower and lower to protect their doctor."}]
t: type of element, i: id, p: points for an edge or position in owning list for a label, u: URL, d: description
parameter | value | description |
---|---|---|
path |
string(required) |
the name of the graph |
x |
double(required) |
left edge of the query rectangle in world coordinates |
y |
double(required) |
upper edge of the query rectangle in world coordinates |
width |
double(required) |
width of the query rectangle in world coordinates |
height |
double(required) |
height of the query rectangle in world coordinates |
types |
integer(required) |
types of elements to be included into the response as a bitmask (e.g. 3 means nodes and edges)
|
hit test information for a given graph and a given axis-parallel query rectangle in prefixed JSON format. This is a synonym for getElementBounds.
parameter | value | description |
---|---|---|
path |
string(required) |
the name of the graph |
x |
double(required) |
left edge of the query rectangle in world coordinates |
y |
double(required) |
upper edge of the query rectangle in world coordinates |
width |
double(required) |
width of the query rectangle in world coordinates |
height |
double(required) |
height of the query rectangle in world coordinates |
types |
integer(required) |
types of elements to be included into the response as a bitmask (e.g. 3 means nodes and edges)
|
hierarchy information for a given graph in prefixed JSON format
{}&&[ {"i":"n-0","t":1,"s":{"x":531.0,"y":-30.0,"w":20.0,"h":24.0}},
{"i":"n-1","t":1,"p":"n-0","s":{"x":640.0,"y":7.0,"w":20.0,"h":24.0}},
{"i":"n-2","t":2,"p":"n-1","s":{"x":732.0,"y":44.0,"w":20.0,"h":24.0}},
{"i":"n-3","t":0,"p":"n-2"},{"i":"n-4","t":0,"p":"n-2"},{"i":"n-5","t":0,"p":"n-2"},
{"i":"n-6","t":0,"p":"n-2"},{"i":"n-7","t":0,"p":"n-1"},{"i":"n-8","t":0,"p":"n-0"},
{"i":"n-9","t":0,"p":"n-0"},{"i":"n-10","t":0},{"i":"n-11","t":0},{"i":"n-12","t":0}]
i: id, t: type (0: normal node, 1: open group, 2: closed group), s: bounds of state label
for group or folder nodes, p: parent node
parameter | value | description |
---|---|---|
path |
string(required) |
the name of the graph |
a list of names of graphs in prefixed JSON format, which are suitable for loadGraph
{}&&[
"bigtree.graphml",
"groups.graphml",
"hierarchy.graphml"
]
If the value of the parameter "path" is "foo.graphml", and there is not yet a graph cached for the name "foo.graphml" in the session of the request, then the graph is loaded from the file "foo.graphml" from the directory "resources/graphs" in the web application, to which this servlet belongs, and cached using the name "foo.graphml". Reloading a graph which is already cached can be forced by setting the optional parameter "reload" to "true".
a array of file format descriptions available for downloadGraph in prefixed JSON format,
each entry is an array containing a description and a file name extension, e.g.,
["GraphML Format","graphml"]
The "downloadGraph" request has a mandatory parameter "path" and an optional parameter "format". The parameter "path" contains the name of the graph to be downloaded.
The parameter "format" specifies the format for the download. It defaults to "ygf". Possible values can be queried with a "downloadableFormats" request. The values are filename extensions of yFiles for Java graph formats; "ygf", "gml", "graphml", "graphmlz" and "tgf". Moreover some image formats are supported: "gif", "jpg", "png" and "bmp" Depending on the server configuration "png" and "bmp" may not be available and "pdf" and "swf" may additionally be available, if the server can access yExport. The response for this request is a binary stream containing the graph in the requested format. For the graph formats "ygf", "gml", "graphml", "graphmlz" and "tgf" the whole graph is exported. For the image formats "gif", "jpg", "png" and "bmp" there are additional parameters for specifying the size and contents of the target image.
The parameters x, y, z, w and h are required for image formats. They specify the part of the graph to be exported and the magnification of the target image. Note that there is a limit of 2000 on the target width and height in order to protect the server from allocating too much memory for a single request. If a width or height greater than this limit is requested, then width, height and zoom are scaled down to meet the limits before the request is processed.
parameter | value | description |
---|---|---|
path |
string(required) |
the name of the graph |
format |
One of:
|
the format for the response (default: ygf), depending on the server additional formats are possible (see "downloadableFormats") |
x |
left edge of the exported image in world coordinates for image formats, this parameter is required for image formats |
|
y |
upper edge of the exported image in world coordinates for image formats, this parameter is required for image formats |
|
z |
zoom of the exported image for image formats, this parameter is required for image formats |
|
w |
width of the exported image in pixels for image formats, this parameter is required for image formats |
|
h |
height of the exported image in pixels for image formats, this parameter is required for image formats |
caches a new empty graph for the given name
parameter | value | description |
---|---|---|
name |
string(required) |
the name of the graph |
returns a prefixed JSON object containing the names of the available node types (node realizers)
{}&&{"nodeRealizers":["blue diamond","blue square","red circle","yellow square"]}
returns a PNG image showing a sample node realized with the given node realizer
parameter | value | description |
---|---|---|
type |
string(required) |
the name of the node realizer (node type), suitable values are returned by getRealizers |
creates a new node in a cached graph and returns a prefixed JSON object containing the id
of the new node and the new world bounds
{}&&{"id":"n-25","bounds":{"minX":304,"minY":-52,"maxX":871,"maxY":383}}
creates a new group or folder node in a cached graph and returns a prefixed JSON object
containing the id of the new node, the changed hit info and the new world bounds
{}&&{"id":"n-27","hinfo":[ {"i":"n-27","t":1,"s":{"x":459.0,"y":297.0,"w":20.0,"h":24.0}},
{"i":"n-12","t":0,"p":"n-27"},{"i":"n-11","t":0,"p":"n-27"},
{"i":"n-0","t":1,"s":{"x":531.0,"y":-30.0,"w":20.0,"h":24.0}},
{"i":"n-1","t":1,"p":"n-0","s":{"x":640.0,"y":7.0,"w":20.0,"h":24.0}},
{"i":"n-2","t":2,"p":"n-1","s":{"x":732.0,"y":44.0,"w":20.0,"h":24.0}},
{"i":"n-3","t":0,"p":"n-2"},{"i":"n-4","t":0,"p":"n-2"},
{"i":"n-5","t":0,"p":"n-2"},{"i":"n-6","t":0,"p":"n-2"},
{"i":"n-7","t":0,"p":"n-1"},{"i":"n-8","t":0,"p":"n-0"},
{"i":"n-9","t":0,"p":"n-0"},{"i":"n-10","t":0},{"i":"n-25","t":0}],
"bounds":{"minX":304,"minY":-52,"maxX":886,"maxY":398}}
parameter | value | description |
---|---|---|
name |
string(required) |
the name of the graph |
x |
x coordinate of the new node in world coordinates (default 0) |
|
y |
y coordinate of the new node in world coordinates (default 0) |
|
closed |
One of:
|
a folder node is created, if this parameter is true, a group node otherwise (default) |
type |
the type of node, suitable values are returned by getRealizers |
|
subNodeIds |
comma separated ids of the nodes to become members of the inner graph of the newly created node |
|
parentNodeId |
id of the parent group or folder node for the new group node, if not specified and no subnode ids are given use the currently visible subgraph, if not specified and subnode ids are given, their nearest common ancestor becomes the parent of the new group |
converts the group node with the given id into a folder node. The same kind of information as for createGroup is returned.
converts the folder node with the given id into a group node. The same kind of information as for createGroup is returned.
creates a new edge in a cached graph and returns a prefixed JSON object containing the id
of the new edge and the new world bounds
{}&&{"id":"e-30","bounds":{"minX":304,"minY":-52,"maxX":871,"maxY":428}}
moves the positions of a set of nodes according to a shift vector. The new graph bounds are returned.
{}&&{"bounds":{"minX":203,"minY":-41,"maxX":871,"maxY":428}}
parameter | value | description |
---|---|---|
name |
string(required) |
the name of the graph |
ids |
string(required) |
comma-separated ids of the nodes to be moved |
x |
double(required) |
x coordinate of the shift vector in world coordinates |
y |
double(required) |
y coordinate of the shift vector in world coordinates |
route |
route the affected edges, if this parameter exists and is not equal to 0 |
resizes a set of nodes according to a mode and deltas for width and height. The new graph bounds are returned.
{}&&{"bounds":{"minX":203,"minY":-41,"maxX":871,"maxY":428}}
parameter | value | description |
---|---|---|
name |
string(required) |
the name of the graph |
ids |
string(required) |
comma-separated ids of the nodes to be resized |
m |
string(required) One of:
|
the mode, i.e. the corner or side which changes |
dw |
double(required) |
the delta for the node widths in world coordinates |
dh |
double(required) |
the delta for the node heights in world coordinates |
route |
route the affected edges, if this parameter exists and is not equal to 0 |
removes the first node or edge at the given coordinates and returns a prefixed JSON object containing the id of the removed node or edge if any and the new world bounds
removes the graph elements with the given ids and returns a prefixed JSON object containing the id of the removed node or edge if any and the new world bounds. Note that dependent objects are also removed. For example removing a node leads to removing all its adjacent edges and all labels of the removed node and the adjacent edges.
returns the text of the given node label or the text of the first label of the given node as a plain text in UTF-8 encoding.
sets the text of the given node label or the text of the first label of the given node and returns the id of the label.
performs a layout algorithm on the given graph and returns a prefixed JSON object containing the new world bounds.
switches the currently displayed graph to the inner graph of a group or folder node. The same kind of information as for createGroup is returned.
switches the currently displayed graph to its parent graph. The same kind of information as for createGroup is returned.
parameter | value | description |
---|---|---|
name |
string(required) |
the name of the graph |
moves a set of nodes to another nested graph. Optionally the nodes can also be moved to another location as in the moveNodes request. If this is desired the x and y parameters have to be given. The same kind of information as for createGroup is returned.
parameter | value | description |
---|---|---|
name |
string(required) |
the name of the graph |
subNodeIds |
string(required) |
comma separated ids of the nodes to be moved |
parentNodeId |
the id of a group or folder node, which is the parent of the target graph (default root graph) |
|
x |
x coordinate of the shift vector in world coordinates |
|
y |
y coordinate of the shift vector in world coordinates |
|
route |
route the affected edges, if this parameter exists and is not equal to 0 |
moves each node in a set of nodes one level up.
queries whether support for undo and redo operations for a particular graph is enabled. The state is returned as text.
parameter | value | description |
---|---|---|
name |
string(required) |
the name of the graph |
enables or disables support for undo and redo operations for a particular graph. The new state is returned as text.
queries whether an undo and a redo operation for a particular graph is currently possible.
The information is returned as a prefixed JSON object like the following.
{}&&{ "canUndo" : true, "canRedo" : false }
parameter | value | description |
---|---|---|
name |
string(required) |
the name of the graph |
performs an undo operation for a particular graph. Whether a further undo or redo operation
is possible is returned as a prefixed JSON object like the following.
{}&&{ "canUndo" : true, "canRedo" : false }
parameter | value | description |
---|---|---|
name |
string(required) |
the name of the graph |
performs a redo operation for a particular graph. Whether a further undo or redo operation
is possible is returned as a prefixed JSON object like the following.
{}&&{ "canUndo" : true, "canRedo" : false }
parameter | value | description |
---|---|---|
name |
string(required) |
the name of the graph |
invokes a server side action. All parameters are optional except for the id which
identifies the action to be performed. Some parameters are only useful, if another
parameter is present, e.g. the "hitTypes" parameter is only needed if hasHitTest
is present and has the value "true".
The response is an object represented in prefixed JSON format. All members of
the response object are optional.
customResponse: a string
zoom: a double
viewPoint: a JSON string as created by JSONSupport.pointString()
refreshCanvas: a boolean
worldBounds: a JSON string as created by JSONSupport.rectangleString()
hitTestData: a JSON string in the format as described in the getElementBounds request
hierarchyData: a JSON string in the format as described in the getHierarchyInfo request
selection: a string containing comma-separated node and edge ids
parameter | value | description |
---|---|---|
id |
string(required) |
the id of the action |
graphName |
the symbolic name of the graph for the action |
|
hasHitTest |
whether a hit test is available at the client side |
|
hitTypes |
the event mask for the client side hit test, if it is available |
|
hasHierarchy |
whether a hierarchy manager is available at the client side |
|
hasSelection |
whether a selection is available at the client side |
|
selection |
ids of selected nodes and edges at the client side |
|
hasCanvas |
whether a canvas is available at the client side |
|
width |
the width of the client side canvas in view units |
|
height |
the height of the client side canvas in view units |
|
zoom |
the zoom factor of the client side canvas |
|
viewpoint |
the world coordinates of the upper left corner of the visible region in the client side canvas |
|
mouse |
the view coordinates of the mouse position |
|
customParameter |
a custom parameter for the server side action |
Copyright (c) 2006-2012 yWorks. All Rights Reserved.