create new tag
, view all tags

FlowchartPluginDev Discussion: Page for developer collaboration, enhancement requests, patches and improved versions on FlowchartPlugin contributed by the TWikiCommunity.
• Please let us know what you think of this extension.
• For support, check the existing questions, or ask a new support question in the Support web!
• Please report bugs below

Development discussion for FlowchartPlugin

Hi! The FlowchartPlugin is now relised. smile

I put a translation to Brasilian Portuguese in FlowchartPluginPtbr, compatible with the TopicTranslationsPlugin

I made this plugin to help the Click-And-Install Project. The implementation design is not so good and has some words in portuguese, but works correctly. stick out tongue

-- AurelioAHeckert - 28 Jun 2005

Great idea! Thanks for your contributions!

-- FranzJosefSilli - 28 Jun 2005

Hey Aurelio, thank you very much for contributing this Plugin. Innovative, and very cool idea cool!

And probably the first time I did not need to follow-up by creating the Dev / Appraisal topics (nor fix the breadcrumb)

-- PeterThoeny - 28 Jun 2005

Now, I like this. So far we have been creating flowcharts in Visio and attaching them -- this is a great addition.

-- SteveRJones - 28 Jun 2005

Looks great!

First thing I did was to open the generated SVG on FlowchartPlugin. Adobe Illustrator shows the texts in the boxes with inverted alignment: make them align left, and all texts are put in mid air at the left side of the boxes. So it appears the texts are currently aligned right...

-- ArthurClemens - 29 Jun 2005

checked .zip into CVS

-- WillNorris - 19 Jul 2005

I seem to be having a problem with the install. When I edit FlowchartPluginExample on my installation, I get updated txt and svg files, but no updates are made to the png. ImageMagik runs from command line, so I assume it should be working for the plugin. Error logs record an error at line 252 in FlowchartPlugin.pm:

[Wed Aug 10 15:05:04 2005] [error] [client] [Wed Aug 10 23:05:04 2005] c:\\twiki\\bin\\save: Can't exec "convert": No such file or directory at /twiki/lib/TWiki/Plugins/FlowchartPlugin.pm line 252.\n

Any ideas?

-- RolandJones - 10 Aug 2005

Firts, there was no text in boxes. I had to install gsfont to solve this problem (Linux / Debian). Perhaps, could you put gsfonts as dependence?

Thanks for your contributions.

-- ThierryPasquier - 13 Aug 2005

Can I change the localhost to a machine name in %ATTACHURL% and %PUBURL%? How?

-- WeiyiYang - 27 Dec 2005

This Plugin doesn't work! - or at least, not for me. I copied the example topic to a new sandbox topic to try it out but no flowchart was generated. After investigation, it appears that the svg file is being generated but the png file is not. In the FlowchartPlugin is a system call to the ImageMagick program called convert. e.g. system("convert fname.svg fname.png") This runs successfully and produces a png file if I manually run it from the command line, but when run from TWiki it does nothing other than raise the following error in the Apache log - 'convert: Extra characters at end of file'

This looks like a very useful plugin if I can get it to work. Has anyone else had success? Does anyone have any idea why my installation might be failing? I've installed many plugins but this is the only one that doesn't work - please help!

-- DavidBaker - 12 Jan 2006

Hi David,

Sory... I have no idea why is this happening... Someone know?

-- AurelioAHeckert - 15 Jan 2006

The problems people are having above with Can't exec "convert": No such file or directory are because convert is not on TWiki's PATH. Remember that TWiki doesn't run with your normal user PATH so just because it works from the command line doesn't mean it will work in TWiki; edit the TWiki.cfg file and make sure the directory containing convert is in the $safeEnvPath variable. Often on UNIX or GNU/Linux systems convert is installed in /usr/bin/X11 which is not on the PATH by default.

DavidBaker is seeing the extra characters error due to a bug in the plugin. It doesn't print a newline at the end of the SVG file, and (at least some versions of) convert don't like that. Edit line 321 of FlowchartPlugin.pm and add a \n to the string after </svg>

For me, even after I fix that, convert fails with a message Non-conforming drawing primitive definition (Vera). I haven't figured this out yet. I'm using ImageMagick 5.4.7.

I've found another bug in the plugin, as well: the code to create the pub directory is wrong. Currently it says (FlowchartPlugin.pm line 249):

  TWiki::Func::saveFile( "$myPub/flowchart_$topic.svg", $svg );
  TWiki::Func::saveFile( "$myPub/flowchartMapImg_$topic.txt", $mapImg );
  system ("mkdir", "$myPub");

There are a few things wrong here: first, it tries to save files in $myPub before it creates it. Second, it always creates the directory so if the directory already exists you'll get error messages printed to your Apache log files every time this runs. And third, using system() to invoke mkdir is not the best way to do this: you should be using the Perl builtin function mkdir() for portability and efficiency.

I rewrote this stanza like this:

  -d $myPub || mkdir( $myPub, 0775 );
  TWiki::Func::saveFile( "$myPub/flowchart_$topic.svg", $svg );
  TWiki::Func::saveFile( "$myPub/flowchartMapImg_$topic.txt", $mapImg );

-- PaulSmith - 18 Jan 2006

OK, I found out what's going on with my error re: Non-conforming drawing primitive definition. Apparently the version of convert I'm using can't accept font-family values that contain whitespace. The default font-family for this plugin is Bitstream Vera Sans so it fails. I changed the name of the font-family to Helvetica (in FlowchartPlugin.pm line 181), then convert was able to properly generate the PNG.

I think you should update the plugin settings to allow the font to be a setting chosen by the user, rather than hardcoded in the plugin. And, you should mention that some versions of ImageMagick have this problem with whitespace inside font names.


-- PaulSmith - 18 Jan 2006

Paul, since you have discovered various fixes why not request permission from AurelioAHeckert (since he does not provide permission) for you to apply the fixes and rev the plugin?

Also, I just got through installing the latest version of ImageMagick (6.2.5) and everything appears to work well - perhaps you could update the plugin table to indicate that there is perhaps a version dependency.

-- SteveRJones - 19 Jan 2006

Just managed to get my installation working! I discovered there was another program named convert (or maybe just an old version) located in /usr/bin that was being called in preference to the latest version in /usr/local/bin - the default installation location for ImageMagick 6.2.5. I didn't make any of the changes suggested above by Paul and it still worked - so maybe this latest version solves the problem of extra characters.

-- DavidBaker - 19 Jan 2006

One of the dependencies that this plugin has is on an outside utility - convert - that may not be located where the tool expects things to be located. For example, our tools are not located in an area that is pointed to by the path. Perhaps we need an option that would allow the installer to specify the location path, but as Peter points out this opens one up to abuse.

-- SteveRJones - 19 Jan 2006

Ok, I've run into some interesting issues with this plugin.

  1. I'm trying to figure out why none of the debug statements print into data/debug.txt
  2. The plugin is not creating the .svg file in the /pub dir. I applied Paul's fix but something is still wrong and #1 needs to be fixed in order to debug this thing.
  3. The plugin needed a variable that points to the location of the ImageMagick utilities (convert). I included this as a settable variable within the plugin
  4. Most importantly, most of the work is initiated within the AfterSave handler and there was a funky little write statement that was populating /temp with files starting with 'xxx' everytime ANY topic was saved.

-- SteveRJones - 20 Jan 2006

More one bug report by mail from Kugelberg:

I just found your FlowchartPlugin, and I really like it. But as I tried to create my first own FlowChart, I got an error:

OopsException(attention/save_error web=>Operation topic=>ACCImplementationProject params=>Can't create file /var/www-stage-twiki/twiki/pub/Operation/ACCImplementationProject
/flowchart_ACCImplementationProject.svg - No such file or directory
I assume the FlowchartPlugin.pm does not look if the directory where the Chart should be placed in es existing. Probably you can just create it if it is not there. Or did I just miss some configuration?!

-- AurelioAHeckert - 15 May 2006

I am having an exception when saving a topic with this plugin enabled in a hyerarchical web. It says that it cannot create a topic in /tmp/xxx_Web/topic...

Probably it would be enough to replace / with _ before saving the temporary data.

-- AndreaSterbini - 04 Sep 2006

Can we get an updated release with fixes and testing on Twiki4?

-- BryceSchober - 12 Sep 2006

I get the plugin error:

TWiki::Plugins::FlowchartPlugin could not be loaded.  Errors were: 
Can't locate Encode.pm in @INC (@INC contains: /twiki/lib/CPAN/lib//arch/ /twiki/lib/CPAN/lib//5.6.1/i386-linux/ /twiki/lib/CPAN/lib//5.6.1/ /twiki/lib/CPAN/lib// /twiki/lib . /usr/local/lib/perl/5.6.1 /usr/local/share/perl/5.6.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.6.1 /usr/share/perl/5.6.1 /usr/local/lib/site_perl .) at /twiki/lib/TWiki/Plugins/FlowchartPlugin.pm line 261.
BEGIN failed--compilation aborted at /TWiki/Plugins/FlowchartPlugin.pm line 261.
Compilation failed in require at (eval 35) line 1.
BEGIN failed--compilation aborted at (eval 35) line 1.

As you can see, I'm on Perl 5.6.1. It's a hosted install, so I must copy any CPAN libs to the twiki/lib/CPAN/lib directory. I found the CPAN lib Encode, which didn't help. Neither did Encode-compat. Neither actually have an Encode.pm literally. What Encode.pm is this plugin looking for?

-- BryceSchober - 12 Sep 2006

Aurelio, does this plugin work on TWiki 4? See question in FlowChartDoesNotTrunk.

-- PeterThoeny - 02 Oct 2006

I've attached a context diff file for patching FlowchartPlugin to work with twiki4 as well as fixing the issue with mkdir being called from the wrong place.

-- BrianONeill - 19 Oct 2006

The download - FlowchartPlugin.zip - is not 158.7k but 105k and will not unzip. Other plugin downloads I have just got have been fine!

-- GarryFerguson - 18 Dec 2006

I just checked, I can download and extract the plugin just fine, is 158.7K. There must be a caching issue on your end, possibly on the browser or proxy.

-- PeterThoeny - 18 Dec 2006

I have worked through various issues and applying BrianONeill's patch and making PaulSmith's posted changes, I still have one issue. I'm using Image Magick 5.4.7 which came with Solaris 10, and Perl 5.8.4.

The issue is that while the SVG and PNG files are generated, and the image map works fine, all I see in the PNG file is the shape of the Start box. No text, and no other shapes. I don't know whether it's a case of white-on-white or not, but the end result is the same. I attached the SVG and PNG files in question.

I'm excited about getting this plugin working, so I hope someone can help me.

-- JohnWorsley - 05 Apr 2007

I'm still looking for help with the problem I posted a month ago. What has become of AurelioAHeckert (whose last post here was almost a year ago)?

-- JohnWorsley - 03 May 2007

Hey John,

It sounds like you almost have it working. I think I may have an answer for your problem, but maybe not the fix. Anyways, I decided to pull down the windows sungle user of twiki, to prototype it to see if it could alleviate some of our documentation spagetti. At the same time I noticed that it had this plugin.

Like yourself I couldnt get it working, so I have done some research. It turns out that getPubDir() function is depreciated, and therefore wasnt working. I also had problems with % ATTACHURL %

Therefore, I replaced my $myPub = TWiki::Func::getPubDir() ."/$web/$topic"; with my $myPub = "c:/twiki/twiki/pub/$web/$topic";, this being the full path to the topic. I also changed \% ATTACHURL % with $myPub.

This now works. From the sounds of your problem, I would suggest that your $myPub variable is fine, and that if you change \% ATTACHURL % with $myPub it may just work.

Sorry no diff files or any thing like that, I am not a perl developer and my PC is not setup for that. I can send you a copy of the perl module tho smile

Cheers Harley

-- HarleyColePuls - 05 May 2007

This plugin does not work correctly with subwebs. See ErrorWithSubwebs.

The problem is line 633, where it tries to save a file in tmp. Because of the use of '/' in subweb names, it is looking to save in a directory which does not exist.

Why does it need to save a file in tmp after every save? It does not seem to ever open the file that it saves, so is the file used by ImageMagick?

Is anyone maintaining this plugin? If not, does anybody have some idea how its implemented? Seems a little complex for me to mess around in :-). If the file in tmp is actually used, then the plugin will need to check if its looking at a subweb being created, and either change it so it can be saved, or ignore it and not save.

-- AndrewRJones - 14 May 2007

The TagMePlugin replaces slashes with dots to make subweb work with a single store directory. Something similar could possibly be applied here.

-- PeterThoeny - 16 May 2007

Peter, I don't see any reference in the TagMePlugin topic to replacing slashes with dots, but you wrote it, so I believe you :-). What do you mean by "single store directory?"

I think I figured out how to patch FlowchartPlugin.pm to fix this, and to use the {TempfileDir} config setting. I modified its afterSaveHandler to look like this:

sub afterSaveHandler
### my ( $text, $topic, $web, $error ) = @_;   # do not uncomment, use $_[0], $_[1]... instead

    TWiki::Func::writeDebug( "- ${pluginName}::afterSaveHandler( $_[2].$_[1] )" ) if $debug;
    my $web = $_[2];
    $web =~ s/(\/)/\./g;
    my $tempFileName = $TWiki::cfg{TempfileDir} . '/' . $web . '_' . $_[1] . '.txt';
    TWiki::Func::saveFile( $tempFileName, 'ini' );

-- JohnWorsley - 16 May 2007

Thanks for the patch John. I have uploaded a new release with the fix. The corresponding bugs item is Bugs:Item4085.

-- AndrewRJones - 17 May 2007

Happy to contribute, Andrew, and thanks for the new release.

Are you conversant enough with this plugin that you could help me with the problem I posted on 05 Apr? Even knowing whether the problem is in the generation of the SVG code, or in turning the SVG code into the PNG file, would be helpful.

-- JohnWorsley - 17 May 2007

No sorry, I really don't know much about how this plugin generates the images, and have no experience with Image Magick, so im afraid I can't help you.

I have uploaded another version of the plugin, as the version in SVN had another bug (Bugs:Item4090).

-- AndrewRJones - 18 May 2007

Here is what I found while troubleshooting this plugin:

the plugin file uses 'convert', but you might want to give the full path to this, like /usr/local/bin/convert

also, the Tempfiledir variable needs to be set correctly, I set it to '/tmp' . '/' .......

This fixed the problem and works like a charm!!

Thanks a bunch for this wonderful plugin.

-- HariharanGopalan - 07 Jun 2007

Can not get the plugin to generate a correct SVG. The following chart produces the SVG below it, all wrong as you can see. All boxes is just linked to the next one. I have tried a couple of setups and even the example chart included in the download is rendered incorrectly, box to box linked instead as in the correct one. What would cause this fault? The parsing seams all messed up?

Flowchart Start

  • Type: Start

Ruta ett

  • Id: ett
  • Type: Question
  • Yes: tva
  • No: tva

Ruta tva

  • Id: tva
  • Type: Question
  • Yes: ett
  • No: fim


  • Id: fim
  • Type: End

Gives this SVG:

<rect id="caixa_fluxIten1" x="20" y="15" width="140" height="40" style="fill:#c0d0e0;fill-opacity:1;stroke:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;overflow:visible;" /> Flowchart Start <rect id="caixa_fluxIten2" x="20" y="85" width="140" height="40" style="fill:#c0d0e0;fill-opacity:1;stroke:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;overflow:visible;" /> Ruta ett <rect id="caixa_fluxIten3" x="20" y="155" width="140" height="40" style="fill:#c0d0e0;fill-opacity:1;stroke:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;overflow:visible;" /> Ruta tva <rect id="caixa_fluxIten4" x="20" y="225" width="140" height="40" style="fill:#c0d0e0;fill-opacity:1;stroke:none;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;overflow:visible;" /> Slut

<path id="form_fluxIten1_to_fluxIten2" d="M 90,55 C 90,55 90,85 90,85" style="stroke-width:2px;stroke:#000000;stroke-opacity:0.40;fill:none;" /> <path id="seta_to_fluxIten2" d="M 5,10 L 0,0 L 5,2 L 10,0 L 5,10 z" transform="translate(85,80)" style="stroke:none;fill:#707070;" />

<path id="form_fluxIten2_to_fluxIten3" d="M 90,125 C 90,125 90,155 90,155" style="stroke-width:2px;stroke:#000000;stroke-opacity:0.40;fill:none;" /> <path id="seta_to_fluxIten3" d="M 5,10 L 0,0 L 5,2 L 10,0 L 5,10 z" transform="translate(85,150)" style="stroke:none;fill:#707070;" />

<path id="form_fluxIten3_to_fluxIten4" d="M 90,195 C 90,195 90,225 90,225" style="stroke-width:2px;stroke:#000000;stroke-opacity:0.40;fill:none;" /> <path id="seta_to_fluxIten4" d="M 5,10 L 0,0 L 5,2 L 10,0 L 5,10 z" transform="translate(85,220)" style="stroke:none;fill:#707070;" />

-- FredrikLarsson - 25 Jun 2007

I had this problem as well, and found that the fix was commented out in the code. Simply use the alternative code at line 198

    if ( $line =~ m/^[ ][ ][ ]\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) { # Não tá funcionando Porra!
    #if ( $line =~ m/^\s\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) { # Isso tá errado e funciona. Merda!
I am running on Windows/Cygwin using Cygwin Perl. A rough translation of the Portuguese comments are respectively:
  • This doesn't work. Damn
  • This is wrong and works. Shit

-- ByronIgoe - 11 Jul 2007

Dakar used to store bullets with leading tabs; leading spaces are used since TWiki 4. Untested code that should work on both:

    if ( $line =~ m/^\s*\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ {

-- PeterThoeny - 14 Jul 2007

I can't get this to work, and there's nothing in the debug logs. The example works great when I install it, but if I copy the example text onto my own page, the SVG never gets generated. I tried what was suggested above by setting TempFileDir, giving the plugin the full path to convert, what Peter said about Dakar storing bullets, nothing works. We're on twiki 4.0.2 on FreeBSD.

-- MichelleHedstrom - 29 Aug 2007

There are a number of things you can check. Are you using the latest version of the plugin? Is ImageMagic installed properly? Try running convert -version and see if it runs. If you need the full path name for convert, you may need to change the plugin on line 216. Are the permissions set up correctly in the pub directory? Have you checked the Apache logs and the wiki warn logs?

Hope this helps. If not, try and provide some more information.

-- AndrewRJones - 30 Aug 2007

Is anyone else using this plugin on a Solaris TWiki?

I am still unable to get it to work properly with my Solaris TWiki. As I posted back in April, my .png images lack the text inside the boxes.

When I run a manual convert, e.g. convert /web/twiki/pub/Sandbox/TestFlowchartPlugin5/flowchart_TestFlowchartPlugin5.svg  /web/twiki/pub/Sandbox/TestFlowchartPlugin5/flowchart_TestFlowchartPlugin5.png, I get an error: "convert: FreeType library is not available (/usr/openwin/lib/X11/fonts/Type1/Helvetica.pfa)." I assume that's why I'm not getting text in my images.

I have tried several different font-family values in the $styleText line in FlowchartPlugin.pm, but the error is always for that Helvetica file.

I do have FreeType installed; just to be sure, I installed it (v2.3.1) fresh from sunfreeware.com, but that didn't change the error.

My web searches haven't turned up anything helpful.

-- JohnWorsley - 27 Sep 2007

I had the same problem with missing text in the boxes. Testing on command line showed following:

/srv/www/twiki/pub/Sandbox/FlowChart # convert flowchart_FlowChart.svg test.png
convert: unable to read font `/usr/share/ghostscript/fonts/n019003l.pfb'.
/srv/www/twiki/pub/Sandbox/FlowChart # ll /usr/share/ghostscript/fonts/
/bin/ls: /usr/share/ghostscript/fonts/: Datei oder Verzeichnis nicht gefunden (not found)
So I just installed Ghostscript Fonts ghostscript-fonts-std (with Yast under Suse Linux) and the texts are properly created now!

But another Problem occured: all boxes look the same (blue rectangulars), the Type Attribute doesn't seem to change anything.

The alternative code at FlowchartPlugin.pm line 198 (as described by ByronIgoe) does the trick:

    if ( $line =~ m/^[ ][ ][ ]\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) { # Não tá funcionando Porra!
    #if ( $line =~ m/^\s\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) { # Isso tá errado e funciona. Merda!

Another question: I'd like to refer to TWiki-Topics instead of headlines. How can this be achieved?

-- ChrisHausen - 25 Oct 2007

I got an access denied while trying to save a flowchart, so I followed one of the recommendations in this topic and tried setting TempfileDir to /tmp. This worked for flowcharts, but broke WebStatistics. WebStatistics started storing temp files in the /tmp folder when run as a cron job, and a forced update would give errors because the temp file already existed in /tmp. When the Statistics were generated by /bin/statistics, it created read-only temp files owned by the user running the cron job, and as forced statistics are run by apache, the script could not overwrite those files.

I went through the module and could not find any use for the temp files, so I commented out two lines as shown below, and everything works fine.

sub afterSaveHandler
### my ( $text, $topic, $web, $error ) = @_;   # do not uncomment, use $_[0], $_[1]... instead

    TWiki::Func::writeDebug( "- ${pluginName}::afterSaveHandler( $_[2].$_[1] )" ) if $debug;
    my $web = $_[2];
    $web =~ s/(\/)/\./g;
#    my $tempFileName = $TWiki::cfg{TempfileDir} . '/' . $web . '_' . $_[1] . '.txt';
#    TWiki::Func::saveFile( $tempFileName, 'ini' );

-- DhireshVyas - 31 Oct 2007

I have trouble getting this plugin to work. First of all it seems to need the perl svg libraries and gsfonts to work. apt-get install gsfonts libsvg-graph-perl libsvg-perl The plugin now renders the flowchart, but only with blue boxes and just in one vertical line. Same happens with the example file if I edit and save it... Do I need som perl chart/graph library or something?

-- HansRogerLien - 14 Jan 2008

no... this plugin don't need svg modules.

But it is too old and need to be rewrote to work properly on a newer TWiki. :-/

-- AurelioAHeckert - 21 Mar 2008

I am also getting a single line of boxes. I've tried the variants on line 198 in the pm as well. Does anyone have any suggestions? Does this simply no longer work?

-- CorrinneFahl - 28 Jul 2008

I installed this plugin on TWiki-4.0.4-3 and it didn't work. I had these problems:

  • an error message when it tried to save the temp file which prevented me from even saving my topic
  • later, it didn't produce the PNG file (bad path to ImageMagick's 'convert')
  • later, I had the FlowChartDoesNotTrunk problem

I saw the fixes proposed here and added my own for the path-to-convert problem. Here's my diff with all three fixes. Oh -- it works now! smile

I added this line to my lib/LocalSite.cfg for the path to convert:

$TWiki::cfg{Plugins}{FlowchartPlugin}{convert} = '/usr/local/bin/convert';

Here's my diff (a patch):

--- FlowchartPlugin.pm   2007-05-18 00:40:26.000000000 -0700
+++ FlowchartPlugin.pm   2008-08-01 16:01:07.000000000 -0700
@@ -193,13 +193,13 @@
       registerLastItem($id, $title, $type, $goto, $gotoYes, $gotoNo, $color);
       ( $id,  $title,   $type,    $goto,  $gotoYes,  $gotoNo,  $color ) =
       ( '',   '',       'action', '',     '',        '',       ''     );
       $title .= $1;
     #if ( $line =~ m/^[ ][ ][ ]\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) { # Não tá funcionando Porra!
-    if ( $line =~ m/^\s\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) { # Isso tá errado e funciona. Merda!
+    if ( $line =~ m/^\s*\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) { # Isso ta errado e funciona. Merda! # due to BrianONeill
       $id = $2       if ( lc($1) eq 'id' );
       $type = $2     if ( lc($1) eq 'type' );
       $goto = $2     if ( lc($1) eq 'goto' );
       $gotoYes = $2  if ( lc($1) eq 'yes' );
       $gotoNo = $2   if ( lc($1) eq 'no' );
       $color = $2    if ( lc($1) eq 'color' );
@@ -212,13 +212,15 @@
   my $mapImg = &montaMapImg($topic, $web, $percentReduce);
   unless (-d $myPub){
     mkdir $myPub or die "can't create directory $myPub";
   TWiki::Func::saveFile( "$myPub/flowchart_$topic.svg", $svg );
   TWiki::Func::saveFile( "$myPub/flowchartMapImg_$topic.txt", $mapImg );
-  system ("convert", "$myPub/flowchart_$topic.svg",
+  my $PATHTOCONVERT = $TWiki::cfg{Plugins}{FlowchartPlugin}{convert} ||
+     '/usr/bin/convert';  
+  system ($PATHTOCONVERT, "$myPub/flowchart_$topic.svg",
           '-resize', $percentReduce.'%x'.$percentReduce.'%', "$myPub/flowchart_$topic.png");
 my $itemPositionDefault = 1; # will be 1 only to the frist!
 my $firstItemId;
 my $lastItemId;
@@ -632,15 +634,15 @@
     TWiki::Func::writeDebug( "- ${pluginName}::afterSaveHandler( $_[2].$_[1] )" ) if $debug;
     my $web = $_[2];
     $web =~ s/(\/)/\./g;
-    my $tempFileName = $TWiki::cfg{TempfileDir} . '/' . $web . '_' . $_[1] . '.txt';
+#    my $tempFileName = $TWiki::cfg{TempfileDir} . '/' . $web . '_' . $_[1] . '.txt'; # due to DhireshVyas
-    TWiki::Func::saveFile( $tempFileName, 'ini' );
+#    TWiki::Func::saveFile( $tempFileName, 'ini' ); # due to DhireshVyas
     # This handler is called by TWiki::Store::saveTopic just after the save action.
     # New hook in TWiki::Plugins $VERSION = '1.020'
     # Hire is the right position to create the image.
     if ( $_[0] =~ m/%FLOWCHART%/ ) {

-- TroyGoodson - 01 Aug 2008

I have incorporated these changes and the plugin runs, but Image Magick fails to delegate to mf2svg

sh: wmf2svg: command not found
convert: Delegate failed `"wmf2svg" -o "%o" "%i"'.

So I don't get the png generated.

Oddly if I make changes to the example & ook at the SVG my browser renders it as an image, but if I create my own test topic, the browser shows me the text of the svg XML.

I tried installing Image Magick again (though it is there) from CPAN, but I go a lot of errors & it seemed to give up.

I suppose this is to do with my installation, not the plugin itself, but does anyone have an idea how I can proceed? If not this attractive plugin is, sadly, a no go for us.

-- ChrisHogan - 11 Aug 2008

This looks like a very nice plugin. Pity I cannot use it with my ActiveState Perl version of TWiki 4.2.0 due to the ImageMagick requirement.

-- JamesGMoore - 09 Sep 2008

It seems to work. But my flowchart is a single line of gray boxes from top to bottom. All the branching and fancy color are missing.

-- FengZhaolin - 20 Feb 2009

Well I came back to this issue to give it another go and was finally successful at implementing this plugin on TWiki 4.2.0 on Apache 2.2.9 (Win32) with ActiveState Perl v5.8.8 build 822 on Win2k3.

I had to download and install ImageMagick-6.3.3-10-Q16-windows-dll.exe from http://image_magick.veidrodis.com/image_magick/binaries/ and tick the checkbox "Install the PerlMagick for ActiveState Perl v5.8.8 build 822" during the install wizard.

Then I had to enable it in my LocalSite.cfg and then uncomment line 201 of FlowchartPlugin.pm and comment out line 202 (see above):

So they now look like this:

   if ( $line =~ m/^[ ][ ][ ]\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) { # Não tá funcionando Porra!
   #if ( $line =~ m/^\s\*\s*(.+?[^ ])\s*:\s*(.+[^ ])\s*/ ) { # Isso tá errado e funciona. Merda!

if you want to debug it then edit the FlowchartPlugin topic in your TWiki web, set the Debug variable in the Plugin Settings section to the value 1:

Set DEBUG = 1

Then you will see output in your docroot/twiki/data/debug.txt log file. And you can add extra debug lines in the FlowchartPlugin.pm to further track its execution.

-- JamesGMoore - 2009-08-26

If you text is longer than 32 characters the anchors in the SVG image are not working anymore. The plugin doesn't do anything with long text. To fix this add the following to FlowchartPlugin.pm

$anchor = substr($anchor, 0, 32);
after on line 606/607
my $anchor = $title;
$anchor =~ s/[^a-zA-Z0-9]/_/g;  $anchor =~ s/_+/_/g;  $anchor =~ s/(^_*|_*$)//g;

-- TimmoVerlaan - 2011-06-16

Thanks Timmo for the patch! Tracked in TWiki:Item6756.

-- PeterThoeny - 2011-06-17

This is now in SVN trunk and 5.0 branch, and uploaded to FlowchartPlugin topic as well.

-- PeterThoeny - 2011-06-17

After I made this modifcation I found out if the last character is a space it needs to be chopped too. In an anchor a space is represented by an underscore. I created a simple if with rindex() to check if the last character is an underscore.

if ( rindex( $anchor, "_" ) == 31 ) {
  $anchor = substr( $anchor, -1 )

-- TimmoVerlaan - 2011-06-17

Timmo, please check the latest version, it already strips spaces and underscores at the end of the string.

-- PeterThoeny - 2011-06-17

I have the problem where the text (labels) does not show up in the png file. I trace it back to the convert command, which is a simple convert with a resize. The plugin does not pickup that there is any problem, but if I run it by hand, I get a lot of errors regarding the fonts:

sh: gs:  not found
sh: gs:  not found
convert: unable to read font `/opt/freeware/lib/ImageMagick-6.5.4/config//opt/freeware/share/fonts/default/ghostscript/n019003l.pfb' @ annotate.c/RenderFreetype/1023.
convert: Postscript delegate failed `/tmp/magick-XX_Zalid': No such file or directory @ ps.c/ReadPSImage/744.
over and over again.

Yes, I understand that is all wacky. I'll have to investigate the font installation on this box.

So, I listed what fonts are available on my box: convert -list font, and found a system one that looks good, and when I run the convert command with that, it does not throw an error, and the labels show up in the generated png file:

convert -font Courier-Regular flowchart_FlowchartPluginExample.svg test.png

Not sure what to do with this information at the present...

-- AaronLWalker - 2011-06-27

In FlowchartPlugin.pm I replaced the font family "Bitstream Vera Sans" with "Times New Roman" (one that works for me), and it fixes things. Perhaps provide a configurable switch for font family?

line 89:

"font-size:${textSize}px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;stroke:none;font-family:Times New Roman;text-anchor:middle;writing-mode:lr-tb;";

-- AaronLWalker - 2011-06-27

Also (sorry) I find that the list items only work if you use tabs - not if you use the 3-space rule. It should handle both. I really want to start using this!

-- AaronLWalker - 2011-06-28

This may sound like a dumb question, but I really want to use the utility to generate a flow chart and then navigate to different targets by clicking on the flow chart. However, it seems that the page that has this also has all the flow chart related syntax on it in Twiki. How do I use a navigatable flowchart on its own after it has been generated?

-- NimayShah - 2011-09-12

Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatdiff FlowchartPlugin.diff r1 manage 1.8 K 2006-10-19 - 20:08 BrianONeill Diff for fixing FlowchartPlugin for twiki4
PNGpng flowchart_TestTopic0.png r1 manage 3.7 K 2007-04-05 - 23:04 JohnWorsley Test PNG with missing text and only one color
SVG (Scalable Vector Graphics)svg flowchart_TestTopic0.svg r1 manage 6.5 K 2007-04-05 - 23:05 JohnWorsley SVG that generates test PNG with missing text and only one color
Edit | Attach | Watch | Print version | History: r61 < r60 < r59 < r58 < r57 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r61 - 2011-09-12 - NimayShah
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2015 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.