Dale
Dale

Reputation: 5795

How to use multiple TaskSeries in a JFreeChart TaskSeriesCollection

If I put all my tasks into a single TaskSeries, I get normally sized Gantt chart bars, but when I take those same tasks, put them into multiple TaskSeries, it makes really skinny bars. Is this a bug, or am I doing it wrong?

enter image description here Right clicking and 'view image', you can read the code.

Upvotes: 1

Views: 2125

Answers (1)

GrahamA
GrahamA

Reputation: 5923

I don't have a solution but this may help you find one.

In your second example, JFreeChart is allowing space in each task (y axis) for each task series; the bar width is the available space / number of task series. Hopefully this illustration helps:

enter image description here

In (A) I have created 6 tasks, but only one job; and in (B) I have created a second job and attached 3 Tasks to it. In (B) the bars are roughly half as wide, so that there is space for both jobs in all tasks. In (D) you can see that, as I have moved one of the tasks. You can thicken the bars as mush as possible using this code:

  plot.getDomainAxis().setCategoryMargin(0.05);
  plot.getDomainAxis().setLowerMargin(0.05);
  plot.getDomainAxis().setUpperMargin(0.05);
  GanttRenderer renderer = (GanttRenderer) plot.getRenderer();
  renderer.setItemMargin(0);

This thread on the JFreeChart board may shed some further light on the issue.

Upvotes: 4

Related Questions