%%tabbedSection
%%tab-Introduction

And so the inspiration domino effect goes on... :-) The GraphVizPlugin inspired (OK, much more then that) me to create these plugins.  

~ImageGen is a family of JSPWiki plugins that can generate images from textual representations using different libraries. The image source is plain text stored in the wiki (or generated by another plugin), allowing for collaborative development and easy of change. The image output - a graph, chart or diagram, depending on the plugin - is attached to the wiki page.

Currently the following graphical libraries are supported:
* [JFreeChart|ImageGenJFreeChart]
* [GraphViz|ImageGenGraphViz]
* [SnipGraph|ImageGenSnipGraph]
* [SEQUENCE|ImageGenSequence]

__NOTE:__ This functionality only works with the {{~VersioningFileProvider}}
JSPWiki page provider.

__NOTE:__ All the warnings listed in the
[Cautions|http://www.jspwiki.org/wiki/GraphVizPlugin#section-GraphVizPlugin-Cautions]
section of [GraphVizPlugin] also apply to the ~ImageGen plugins.

%%
%%tab-Usage

Add the plugin call to your wiki page defining a graph or
chart. After you save the page, the plugin call will be replaced
with the associated image. If you enabled image map creation,
clicking on specific areas in the image will get you to
corresponding wiki pages.

Note that after making a change to the plugin call (say to change
a chart data) you may have to refresh the page to see the new
version of the image.

See the specific plugin pages for usage instructions.
%%
%%tab-Architecture

In short, those plugins will:

# Read the parameters and body of the plugin;
## If the source attribute is specified, the attachment data will be read instead of the body;
## If the body is used and it contains a nested plugin call, the call is evaluated and its output is substituted in the body of the plugin;
# Determine if it is necessary to create a new image
## If using an attachment as the data source, a simple version comparison is done;
## If using the body, the contents of the attached .dat file are compared against the body data after plugin evaluation. Note that while this will prevent the unnecessary regeneration of the image for changes outside of the plugin body, it will not detect changes in the plugin arguments. 
# If so, call the associated library or application to generate
  the image file and (optionally) the image map;
# Store the generated image (and image map) as attachments in the target page.
# If the body was used, a .dat file is created to hold its contents and is also attached to the target page.
# Output the {{img}} HTML tag.

All of the steps above with the exception of the actual image generation are
implemented by the {{~ImageGeneratorPlugin}} abstract class. This class is
basically a refactoring of the GraphVizPlugin[2] main class that extracts the
attachment management engine, parameter processing and HTML generation. It also
defines the API used to control the creation of image, image map and data files.

The image generation is delegated to the concrete plugin classes, that interface
with a specific graphical application or library.

%%

%%tab-Dependencies

!! Run time
Jar files that implement the graphic libraries used by the ImageGen plugins. You will need to extract some of them from their distribution archives:

! ~JFreeChart
* [jfreechart-1.0.1 and the associated JCommon library| http://www.jfree.org/jfreechart/download.html]
__NOTE:__ ~ImageGen has been tested with ~JFreeChart 1.0.3 version and it seems to work well.

! ~GraphViz
* [GraphViz | http://www.graphviz.org/]
__NOTE:__ that this is not a Java application, but an executable. After downloading, follow the instructions to install it in your web server machine.\\
__NOTE:__ You need also to add graphviz.bin to your jspwiki.properties, pointing to the {{bin}} directory of your local ~GraphViz install.

! SEQUENCE
* [sequence.jar | http://www.zanthan.com/ajm/sequencev9/sequence.jar]

!~SnipGraph 
* [SnipGraph distribution| ftp://snipsnap.org/snipsnap/snipsnap-1.0b2.war]
** graph-snipsnap.jar

!! Build time 
To build (using Ant) and test the code from attached source .zip file, you will need the following jar files in addition to the ones listed above.
* JDK 1.5 or better (ImageGen uses the new Generics feature).
* JSPWiki.jar (version 2.4.24 or better)
* [easymock.jar|http://prdownloads.sourceforge.net/easymock/easymock1.1.zip?download]


%%
%%tab-Installation

* Copy to your Wiki {{WEB-INF/lib}} directory:
** the latest ~ImageGen .jar file (see attachment);
** the graphical libraries used by the plugins (listed in the Dependencies tab).
* (Optional) Update the {{jspwiki.plugin.searchPath}} in your WEB-INF/jspwiki.properties to add the package name of the ImageGen plugins. If you don't do that, you have to prefix the plugin name with its package name when using it in your page.
* Restart your servlet engine.

%%

%%tab-ChangeLog
; 11-Aug-2006: 
* Fixed bug in [GraphVizPlugin|ImageGenGraphVizPlugin] - was not taking path names with embedded spaces into accounting when launching the graphviz application.
; 08-Aug-2006: 
* Fixed problems with 2.4.x backward compatibility. 
* Added support for [Graphviz|ImageGenGraphVizPlugin] applications (previously supported by John Volkar's [GraphVizPlugin]).
* Added support for reading the graph data from an attachment.
* Added support for evaluation of nested plugin invocations. This allows for the dynamic generation of the  graph data using plugins like [JSPlugin] and [TasksQuery]. Same examples [here|ImageGenNestedPluginExample].
* Changed logic on how to decide if a new image needs to be generated; now looks at the body content after plugin evaluation.
* Added *lots* of customization options for the ~JFreeChart-based plugins.
* Added support for new ~JFreeChart charts:
** [Bubble|BubbleChartPlugin]
** [Spider Web|SpiderWebChartPlugin]
* Upgraded ~JFreeChart to version 1.0.1
* Better documentation of the available parameters for each plugin.

; 30-Jun-2006: Recents changes (probably 2.3.x) in JSPWiki broke the APIs used by ~ImageGen. I am working on an update that fix that problem and adds new functionality. Stay tuned!

; 11-Nov-2005: Added new version of the source zip file. No code changes, just added a missing package and the build.xml file.
%%

%%tab-Discussion
[{InsertPage page=ImageGenDiscussion}]
%%
%%


----
Back to [Contributed Plugins]




----

I am unable to download graph-snipsnap.jar. Any working link?

--saro, 03-Sep-2007

so then i.. i am unable to download graph-snipsnap.war... :(
%%quote
Click the Attach tab, and then click the attachment you want to dowwload. 
/%

See here [ftp://ftp.first.fraunhofer.de/pub/mirror/ftp.snipsnap.org/snipsnap/] it works. SnipSnap is out of maintenance so I have added the jar here in attachments.
----
Any reason why this plugins are limited to using only the versioningfileprovider? Any workarounds to make it work with the filesystemprovider? 
\\
--Praful, 25 Sep 07
----

It looks like the 2008 version of ImageGenPlugin.jar isn't the same as the 2005  ImageGenPlugin-src.jar.   Is source code available for the latest version of this plugin?  If not, would you mind posting it here?


Cheers,\\
--Jon