FlowchartPlugin
This plugin allows you to create a flowchart from topic text.
Example
Stop the mouse above each item and see the tag with the name in a bigger size.
Each item is a link for the text block what was created it and where can exist more information about this step.
The Based SVG
The example above was generated by the content of the topic
FlowchartPluginExample
The items of the flowchart are defined in the following way:
---++ Item of the Flowchart
* Id: unique_name
* Type: Question
* Yes: item_A
* No: item_B
A more complete example is available at
FlowchartPluginExample, once the plugin is installed.
Syntax Rules
To create and display the flowchart, use the macro
%FLOWCHART%
or
%FLOWCHART{...}%
.
This plugin uses the content of the topic and considers that each level two heading (
---++
) indicate the beginning of the definition of a new item of the flowchart.
To specify the item and the derived action is expected a list of the type
* Attribute: Value
Attribute |
Description |
Type |
Type of the flowchart's item. Default: Action . See the valid types in the table below |
Id |
Identification for the Goto . It needs to validate with /[_a-zA-Z0-9]*/ |
Color |
Color differentiated for the item |
Goto |
Indicates so that item it must follow. Default: Next |
Yes |
The same as Goto , but is required for Type: Question |
No |
The same as Goto , but is required for Type: Question |
The valid types are:
Type |
Description |
Start |
Indicates the beginning of a flowchart. This must be the first item |
Action |
The standard type. It indicates an action |
Question |
Opens a fork in the flow. It requires the definition of attributes Yes and No |
End |
Indicates the end of the flowchart (or part of it) |
End-Error |
End for the error case |
To control the beginning and end of of valid headings for the construction of the Flowchart use
%FLOWCHART_START%
and
%FLOWCHART_STOP%
.
If a name is excessively big for the space of the item a line break can be made with
%FLOWCHART_BR%
. This will not intervene with the text of the page, only in the flowchart.
You can changes the appearance of the flowchart by adding the following parameters to the macro:
Parameter |
Description |
item-w |
Width for the flowchart's itens area |
item-h |
Height for the flowchart's itens |
area-w |
Width of the area of the flowchart's itens |
area-h |
Height of the area of the flowchart's itens |
percent |
Percentage of the PNG size presented in relation to the standard of the generated SVG |
text-size |
Size in pixels of the font text |
tag-style |
Style for the img tag |
Tips
Web bowsers normally make a cache of the web page and images. It is possible that after a change to the flowchart you do not see the image update. If this happens click "Reload" in your web browser to clear the cache.
Some flowcharts can become so complex and will be difficult to follow its lines. In this case, increase the area of items, giving a bigger space between them.
eg: %FLOWCHART{ area-w="220" area-h="100" }%
Construction of the Flowchart and Plugin's Working Way
- The blocks initialized by a heading level two
---++
are read as definition of item of the Flowchart (in the same way as the Foswiki:Extensions.SlideShowPlugin).
- An SVG is created with this information and is attached to the topic. This SVG file can be accessed by
%ATTACHURL%/flowchart_%TOPIC%.svg
.
- A PNG is generated by ImageMagick and reduced, so that the image has a good anti-aliasing, that it is not obtained in the direct conversion. The PNG is attached to the topic and can be accessed by
%ATTACHURL%/flowchart_%TOPIC%.png
(use this to separate the flowchart's image of the definition topic when it is rendered).
- A map for the image is created linking the items of the flowchart with the origin of its information, which can contain more information for the implementation.
%ATTACHURL%/flowchartMapImg_%TOPIC%.txt
(use to map the image out of the topic where the flowchart was generated)
%INCLUDE{"%PUBURL%/Web/FlowchartTopic/flowchartMapImg_FlowchartTopic.txt"}%
<img src="%PUBURL%/Web/FlowchartTopic/flowchart_FlowchartTopic.png" usemap="flowchart_FlowchartTopic" alt="Flowchart" border="0" />
- The content of the map file and one image tag presenting the PNG are placed in the place of macro
%FLOWCHART%
.
The files (SVG, PNG and Map) are generated when the topic contend
%FLOWCHART%
is saved.
Plugin Settings
Plugin settings are stored as preferences variables. To reference a plugin setting write
%<plugin>_<setting>%
, i.e.
%FLOWCHARTPLUGIN_ITEM_WIDTH%
To override the default settings, add them to
SitePreferences.
- Default width for the flowchart's itens
- Default height for the flowchart's itens
- Default width for the area of the flowchart's itens
- Default height of the area of the flowchart's itens
- Default size in pixels of the font text
- Default percentage of the PNG size presented in relation to the standard of the generated SVG
- Default style for the
img
tag
- Set TAG_STYLE = border:1px dotted #505050;
- One line description, is shown in the TextFormattingRules topic:
- Set SHORTDESCRIPTION = Create a flowchart from topic text
Plugin Installation Instructions
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.
Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".
If you have any problems, or if the extension isn't available in
configure
, then you can still install manually from the command-line. See
http://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Plugin Info
Related Topics: DefaultPreferences,
SitePreferences,
Plugins