One approach is to override getItemPaint()
in your subclass of GanttRenderer
. Just return a different color for each column
.
Addendum:
I would need to paint the subtask depending on the task completed or not irrespective of the column value.
If I understand, you would return the completed color if that column was completed; otherwise return the non-completed color.
However, please can [you] send a code snippet.
This example should help you see the relationship between row/column and series/item.
Also, could you please let me know how to print the labels on the subtasks.
Because, a GanttRenderer
is an IntervalBarRenderer
, I'd look at a IntervalCategoryItemLabelGenerator.
It's not really working.
What's not working? You haven't posted any code. The example cited is a modification to the standard BarChartDemo1
; it produces the following output. Note in particular how there are three series (parameter row
), each having five values (parameter col
). The super
implementation of getItemPaint()
simply returns the series paints in a cycle. Your would override that behavior to do whatever your application requires.
0 0 java.awt.GradientPaint@7e1a9d1b
1 0 java.awt.GradientPaint@540984b
2 0 java.awt.GradientPaint@53ce669e
0 1 java.awt.GradientPaint@7e1a9d1b
1 1 java.awt.GradientPaint@540984b
2 1 java.awt.GradientPaint@53ce669e
0 2 java.awt.GradientPaint@7e1a9d1b
1 2 java.awt.GradientPaint@540984b
2 2 java.awt.GradientPaint@53ce669e
0 3 java.awt.GradientPaint@7e1a9d1b
1 3 java.awt.GradientPaint@540984b
2 3 java.awt.GradientPaint@53ce669e
0 4 java.awt.GradientPaint@7e1a9d1b
1 4 java.awt.GradientPaint@540984b
2 4 java.awt.GradientPaint@53ce669e