Menu

GANNT charts software on Freeplane?

filippo
2011-07-18
2017-01-03
  • filippo

    filippo - 2011-07-18

    Hi, I am a Freeplane/Sciplore (Docear) fan.
    I am the only one in need of a GANNT chart to combine to Freeplane?
    Let me know and we take it from there to propose this to the developers.
    Thanks for your inputs.
    fil

     
  • Volker Börchers

    Hi fil,

    Freeplane has no builtin support for Gantt charts, but with scripting (know
    how) and the JFreeChart library (see https://sourceforge.net/projects/freepla
    ne/forums/forum/758437/topic/4593586)
    it's possible to add Gantt support
    for yourself:

    1. Create a folder "lib" in your freeplane user directory
    2. Download JFreeChart and copy jfreechart-1.0.13.jar and jcommon-1.0.16.jar to that directory.
    3. Start Freeplane and add lib to Preferences -> Plugins -> Scripting -> Script -> Script classpath.
    4. Create a script file ''gantt.groovy'' in the "scripts" directory in your freeplane user directory with the following content:
        // @ExecutionModes({ON_SINGLE_NODE})
        import groovy.swing.SwingBuilder
    
        import javax.swing.WindowConstants as WC
    
        import org.jfree.chart.ChartFactory;
        import org.jfree.chart.ChartPanel;
        import org.jfree.chart.JFreeChart;
        import org.jfree.data.category.IntervalCategoryDataset;
        import org.jfree.data.gantt.Task;
        import org.jfree.data.gantt.TaskSeries;
        import org.jfree.data.gantt.TaskSeriesCollection;
        import org.jfree.data.time.SimpleTimePeriod;
    
        // adapted from [url]http://www.java2s.com/Code/Java/Chart/JFreeChartGanttDemo1.htm[/url]
    
        //
        // main
        //
        final IntervalCategoryDataset dataset = createDataset();
        final JFreeChart chart = createChart(dataset);
    
        def swing = new SwingBuilder()
        def frame = swing.frame(title:'Groovy Gantt',
                defaultCloseOperation:WC.DISPOSE_ON_CLOSE) {
            panel(id:'canvas') { widget(new ChartPanel(chart)) }
        }
        frame.pack()
        frame.show()
    
        // create task data from the map. Note the use of inject
        // (see [url]http://insidethemachine.wordpress.com/2009/01/25/injectgroovy/)[/url]
        def IntervalCategoryDataset createDataset() {
            return node.map.root.children.inject(new TaskSeriesCollection()) { seriesCollection, seriesNode ->
                seriesCollection.add(seriesNode.children.inject(new TaskSeries(seriesNode.to.plain)) { series, taskNode ->
                    // real live software will be a bit more permissive
                    def dates = taskNode.children.collect{ dateNode -> dateNode.to.date }
                    if (dates.size() != 2)
                        throw new RuntimeException(taskNode + " does not have exactly 2 date children as expected")
                    series.add(new Task(taskNode.to.plain, new SimpleTimePeriod(dates[0], dates[1])))
                    series // this is a "return"
                })
                seriesCollection // this is a "return"
            }
        }
    
        def JFreeChart createChart(final IntervalCategoryDataset dataset) {
            return ChartFactory.createGanttChart(
                "Gantt Chart Demo"  // chart title
                , "Task"            // domain axis label
                , "Date"            // range axis label
                , dataset           // data
                , true              // include legend
                , true              // tooltips
                , false             // urls
            );
            return chart;
        }
    
    1. After saving this file restart Freeplane
    2. Create a new map (Ctrl-n) and copy/paste the following onto the root node:
        Iteration 1
          Design
            2011-07-01
            2011-07-08
          Implement
            2011-07-07
            2011-07-15
          Test
            2011-07-12
            2011-07-22
        Iteration 2
          Design
            2011-07-25
            2011-08-01
          Implement
            2011-07-25
            2011-08-10
          Test
            2011-08-01
            2011-08-12
    
    1. Execute Tools -> Scripts -> Gantt -> Execute Gantt on one selected node

    The chart should appear. The context menu allows some actions like printing
    the chart. Close with mouse or with the Escape key.

    There are lots of opportunities to tune the script but it should be a good
    starting point for more.

    Regards,
    Volker

     

    Last edit: Volker Börchers 2015-01-09
  • rickenbroc

    rickenbroc - 2011-11-28

    Very nice !

     
  • ionizing

    ionizing - 2014-10-03

    Hello. I am wondering if anyone can help determine why I can not get the above instructions to work. I am not well versed in java/groovy and am struggling to understand what part of the code needs fixing. I am using Freeplane 1.3.12 and I followed the above instructions exactly. Instead of seeing data I get the chart popup with only headers (see image.) Imgur Is anyone available to help troubleshoot this with me? If I can get the basic functionality working I can then begin to understand the code better and expand on it for my needs, but right now I can't even figure out how to get it working as described.

    Any help would be greatly appreciated. In the mean time I am trying to learn Groovy and figure this out. I need project management functionality for work related responsibilities, and I really would like to figure out how to make Freeplane do everything I need.

     
  • jokro

    jokro - 2014-10-03

    Hi ionizing,
    I think you did the right thing. I was able to confirm your experience with Freeplane 1.2. The gantt chart appears as the image in your post, a single square. The information in the root not is not converted to a chart. The Instruction dates from 2011, when Freeplane 1.1 or earlier was the standard. I think this is the problem.

    @Volker,
    Could you please look at the problem ?
    The link in your post does not work anymore.
    Regards
    Jodi

     
  • LFWebIM

    LFWebIM - 2015-01-07

    Hi jokro & ionizing,
    I'm using Freeplane 1.3 and couldn't find jcommon. Some links on the explanation post lost their validity. Any way to implement all this ?

     
  • Volker Börchers

    ionizing, it looks like you put everything into the root node but it should look like this:

    Iteration 1
      Design
        2011-07-01
        2011-07-08
      Implement
        2011-07-07
        2011-07-15
      Test
        2011-07-12
        2011-07-22
    Iteration 2
      Design
        2011-07-25
        2011-08-01
      Implement
        2011-07-25
        2011-08-10
      Test
        2011-08-01
        2011-08-12
    

    If you copy and paste it onto a node (not in an open editor) you will get a nested structure.

    I added the Gantt script to the wiki page Scripting: Example scripts using external libraries.

    Regards, Volker

     

    Last edit: Volker Börchers 2015-01-09
  • TVS

    TVS - 2017-01-03

    If possible, I would like to open this two year-old thread:
    I have the same problem as "ionizing" above, which remains despite carefully double-checking instructions, and then following Volker's subsequent instructions (although the test text to be copied into the root node seems to me identical to the first one).

    In attempting to crack this, I have:
    given both execute script, file/read permissions (in FP preferences);
    tried by omitting to add "lib" to FP preferences (as per instructions in " General installation instructions" #3, on http://freeplane.sourceforge.net/wiki/index.php/Scripting:_Example_scripts_using_external_libraries#JFreeChart:_Diagrams_and_Charts );
    used the downloadable "gantt.groovy" file located on the same "General installation instructions" above, and hence omitted any typos in the scripts;
    not found similarities and therefore any help in the other (old) thread on this topic, https://sourceforge.net/p/freeplane/discussion/758437/thread/aa9d1f6e/

    I have FP 1.5.17 and attempted to use jfreechart-1.0.19 (Jul'14). Is the answer simply that the two elements are incompatible?
    I would greatly appreciate assistance.
    Thanks,
    Thomas