Changing stroke for GanttRenderer

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
hepzibahr
Posts: 13
Joined: Mon Sep 04, 2006 2:33 pm

Changing stroke for GanttRenderer

Post by hepzibahr » Fri Nov 18, 2011 10:20 am

Code: Select all

 
private static final BasicStroke stroke1 = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
            1.0f, new float[] { 2.0f, 6.0f }, 0.0f);
/*
**others strokes defined here 
*/

private static final BasicStroke stroke9 = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL,
            1.0f, new float[] { 2.0f, 6.0f }, 0.0f);

public static class MyGanttRenderer extends GanttRenderer {
        public MyGanttRenderer() {
            super();
        }

        public Paint getItemPaint(int row, int column) {

            switch (row) {
            case 0:
                return ChartColor.BLUE;
            case 1:
                return ChartColor.CYAN;
            case 2:
                return ChartColor.MAGENTA;
            case 3:
                return ChartColor.GREEN;
            case 4:
                return ChartColor.YELLOW;
            case 5:
                return ChartColor.RED;
            case 6:
                return ChartColor.GRAY;
            case 7:
                return new Color(215, 0, 215);
            case 8:
                return new Color(215, 64, 215);
            default:
                return Color.pink;
            }
        }

        public Stroke getItemStroke(int row, int column) {
            switch (row) {
            case 0:
                return stroke1;
            case 1:
                return stroke2;
            case 3:
                return stroke3;
            case 4:
                return stroke4;
            case 5:
                return stroke5;
            case 6:
                return stroke6;
            case 7:
                return stroke7;
            case 8:
                return stroke8;
            default:
                return stroke9;
            }
        }
}
I have defined my own renderer by overriding the getItemStroke ..
getItemPaint works but not the stroke ..where do i go wrong

Locked