Creating Gantt Chart reports in Jaspersoft Studio (6.2.1)

Blog Post created by frean04 Employee on Nov 28, 2017

A client requested us recently to add a Gantt Chart of all the investments of a specific Programme in a Jaspersoft Report. If you get a similar question from a client, it's good to know there are two OOTB Gantt Charts (from v14.4)


- Project Schedule: will show a Gantt chart of tasks within an Investment

- Project Planning Schedule: will show a Gantt chart of the list of your investments



If you want to build a similar report with specific changes for a client (for example, our client wanted to see the Gantt chart with Financial years instead of calendar years), then it's useful to know you can re-use the specific Gantt element in your report.


The Gantt element is nothing more than a small subreport (CSK_PRJ_PlanningSchedule_Gantt_Subreport) in the main report. Add as many of these subreports in your design as the # of periods of you will use and lay them out in your report per period. It will represent the part of the Gantt chart specific for that period (or you can use a crosstab if the periods are variable).




The subreport will manage all the specifics of the Gantt bars (colors, size, width …) based on the parameters you’ll send it.


There are specific parameters you need to map this subreport with:



  1. ppmDBVendor: database provider (ex. 'Oracle')
  2. periodType: determines if the gantt displays Annual periods (A), Monthly periods (M) etc...
  3. startPosition: will determine where the bar will start in this period, depending on the start date of the investment (within that period).
  4. totalSize: total size or the bar (will determine until when the bar will be drawn), depending on the end date of your investment (within that period)
  5. defaultGanttColor: color of the bar if no specific color has been specified
  6.  ganttColor: color of the bar (ex. 'blue'). You can add colors by adding in the source


You can add your specific color by adding a conditionalStyle in the source code (example): 


<style name="GanttBar">


              <conditionExpression><![CDATA[$P{ganttColor} == "green"]]></conditionExpression>

             <style forecolor="#2CC059" backcolor="#2CC059">

                    <pen lineColor="#2CC059"/>





And this will populate the graphical element of the Gantt:



Hope that helped people with the same request.