+ * Macro used to invoke GraphViz and render its output on a XWiki page.
+ *
+ *
+ * For it to work properly, you must have the GraphViz plugin enabled and configured.
+ *
+ *
+ * The content of the macro is the source code for the graph, using GraphViz DOT language.
+ *
+ * The parameters are as follows:
+ *
+ *
type: [dot] or neato. Specifies which engine will be used to produce the graph.
+ *
title: Title attribute for the image (floating text box when you hover it). Do not specify it if you
+ * want to use GraphViz tooltip attribute. With the tooltip attributes you can generate different text values for
+ * different regions of the image.
+ *
height: Image height in pixels.
+ *
width: Image width in pixels.
+ *
alt: Alternative text (alt attribute) for the image, in case it cannot be rendered by the browser.
+ *
format: This attribute specifies what will be GraphViz output and also how it will be rendered in the
+ * HTML. The HTML output of the macro will be one of the following, depending on this attribute:
+ *
+ *
OBJECT and EMBED html tag for: svg, svgz. See http://wiki.svg.org/SVG_and_HTML
+ *
The text as output by GraphViz for: canon, dot, xdot, imap, cmapx, imap_np, cmpax_np, plain, plain-ext. Remember
+ * that for some of these formats, like cmpax and cmapx_np, the text will actually be HTML code.
+ *
IMG html tag for anything else. Caution: Not all
+ * formats supported by GraphViz can be referenced by an IMG tag. Depending on the format you choose this macro may
+ * not produce a valid result.
+ *
+ *
+ *
clickable: If present and not false indicates that the IMG tag must reference the link map produced by
+ * GraphViz ("cmapx" format). Anonymous graphs will provoke errors if this attribute is true, so don't forget to name
+ * them. This parameter will have no effect if format specifies anything different from an IMG tag to be
+ * rendered - what doesn't mean you can't have clickable SVG images, you just don't need an extra map tag for that.
+ * Executes graphviz and returns the url for the produced file.
+ *
+ *
+ * @param content GraphViz source code. View http://www.graphviz.org/doc/info/lang.html for the language
+ * specification.
+ * @param dot Whether the dot engine should be used instead of the neato engine. Other engines are not supported.
+ * @param format Any GraphViz output format. View http://www.graphviz.org/doc/info/output.html for more information.
+ * @param context XWikiContext
+ */
+ public String getDotResultURL(String content, boolean dot, String format, XWikiContext context) throws IOException
+ {
+ String filename = writeDotImage(content, format, dot);
return context.getDoc().getAttachmentURL(filename, "dot", context);
}
}