Hi,
I want to have different color for property Complete Color for each bar of Gantt diagram.
Is it possible???
Thank You
Hi,
I want to have different color for property Complete Color for each bar of Gantt diagram.
Is it possible???
Thank You
https://docs.inductiveautomation.com/display/DOC81/XY+Chart+Example+-+Gantt+Chart
11 Our data includes a key for color, but our chart isn't currently using it. Set series[0].column.deriveFieldsFromData.fill.color to "color". This will map the "color" key in our data source to each block in the chart..
I used component Gantt Chart in Vision, not XY chart used as Gantt chart…
JFreeChart’s GanttRenderer
only supports a single complete color. It might be possible to subclass GantRenderer
yourself, by implementing the configureChart
extension function (if you’re on a version new enough to have it), but it’s going to take some doing.
Do you have an example???
It’s not trivial. This is about as much time as I’m willing to spend; you have to ‘cache’ the task you’re looking at in one function and reference it in another:
from org.jfree.chart.renderer.category import GanttRenderer
class CustomGanttRenderer(GanttRenderer):
def __init__(self):
self.columnsToColors = {
"First Task": system.gui.color(255, 0, 0),
"Second Task": system.gui.color(128, 128, 128),
"Third Task": system.gui.color(0, 0, 255),
}
self.currentColumn = None
def drawTasks(self, graphics, state, dataArea, plot, domainAxis, rangeAxis, dataset, row, col):
self.currentColumn = dataset.getColumnKey(col)
self.super__drawTasks(graphics, state, dataArea, plot, domainAxis, rangeAxis, dataset, row, col)
def getCompletePaint(self):
return self.columnsToColors.get(self.currentColumn, self.super__getCompletePaint())
chart.plot.renderer = CustomGanttRenderer()
Thank You
I try, but not work