I’m trying to create a Gantt chart in the reporting module. My first attempt was to use the chart scripting to take advantage of the jfree chart and change the bar chart into a gantt chart. I do not get any errors with my script, but it still renders the bar chart in the report. Has anyone been successful in building a Gantt chart in the reporting module?
def configureChart(data, chart):
"""
Provides an opportunity to perform chart
configuration right before the report is
rendered. Report Parameters and Data Sources
are accessible via the data['myKey'] command.
Arguments:
data: This is a map whose keys are report
data keys. Values should be sequences,
maps, scalar values, or Datasets.
chart: A JFreeChart object that will be
drawn on the report.
"""
from org.jfree.chart import ChartFactory
from org.jfree.data.category import IntervalCategoryDataset
from org.jfree.data.gantt import Task
from org.jfree.data.gantt import TaskSeries
from org.jfree.data.gantt import TaskSeriesCollection
s1 = TaskSeries("Series 1")
s1.add(Task("Test1", system.date.addDays(system.date.now(),-8), system.date.addDays(system.date.now(),-6)))
s1.add(Task("Test2", system.date.addDays(system.date.now(),-6), system.date.addDays(system.date.now(),-4)))
s1.add(Task("Test3", system.date.addDays(system.date.now(),-4), system.date.now()))
dataset = TaskSeriesCollection()
dataset.add(s1)
chart = ChartFactory.createGanttChart('Gantt Chart', 'TaskName', 'Date', dataset, True, False, False)