who can share Gantt sample

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
princeahan
Posts: 2
Joined: Mon Nov 14, 2005 8:30 am

who can share Gantt sample

Post by princeahan » Mon Nov 14, 2005 8:41 am

hi, anyone can share a Gantt sample,the sample in demo is not enough,too sample. I saw the topic "the index of subitem",but it is only a part of source,can anyone share the complete sample source include:how to set the color ,url and tips of subtask? thanks a lot.
my mail: princeahan_wang@hotmail.com

angel
Posts: 899
Joined: Thu Jan 15, 2004 12:07 am
Location: Germany - Palatinate

Post by angel » Mon Nov 14, 2005 9:03 am

Here you are:

Code: Select all

       JFreeChart chart = ChartFactory.createGanttChart("xxx", "", null, taskseriescollection, false, true, false);

        chart.setBorderVisible(false);
        chart.setBackgroundPaint(new Color(255, 255, 255));

        CategoryPlot plot = (CategoryPlot) chart.getPlot();
        plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);

        MyGanttRenderer renderer = new MyGanttRenderer();
        plot.setRenderer(renderer);

        renderer.setMaxBarWidth(0.1); //prevent very thick bar when only one task

        CategoryURLGenerator generator = new MyStandardCategoryURLGenerator(xId);
        renderer.setItemURLGenerator(generator);

        renderer.setBaseToolTipGenerator(new IntervalCategoryToolTipGenerator("{3} - {4}", DateFormat.getDateInstance()));

        TextTitle textTitle = chart.getTitle();
        textTitle.setPosition(RectangleEdge.TOP);

...

    public class MyGanttRenderer extends GanttRenderer {

        public MyGanttRenderer() {
            super();
        }

        public Paint getItemPaint(int row, int column) {

            return DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[column];
        }
    }

    public class MyStandardCategoryURLGenerator implements CategoryURLGenerator {

        int xId;

        public MyStandardCategoryURLGenerator(int xId) {
            this.xId = xId;
        }

        public String generateURL(CategoryDataset data, int series, int category) {

 ...
    }

bs
Posts: 15
Joined: Sun Dec 18, 2005 3:06 pm
Location: France
Contact:

Post by bs » Mon Dec 19, 2005 10:07 am

Hi,

can share a Gantt sample.

I am student and I need sample who using Gantt Chart.

Thanks

my mail: mztbardo@freesurf.fr
Visit my site : ici Voter

Locked