How to change color of particular sub-task in JFreeChart Gantt Chart?

橙三吉。 提交于 2019-12-01 22:29:46
trashgod

You can override the renderer's getItemPaint() method, as discussed here.

Addendum: As a Gnatt chart uses a GanttRenderer, you'd do something like this to see the existing colors. Just return your chosen color for a given row and column.

plot.setRenderer(new MyRenderer());
...
private static class MyRenderer extends GanttRenderer {

    @Override
    public Paint getItemPaint(int row, int col) {
        System.out.println(row + " " + col + " " + super.getItemPaint(row, col));
        return super.getItemPaint(row, col);
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!