Gantt range (x) axis format

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
cannes
Posts: 1
Joined: Thu Oct 28, 2010 9:16 am
antibot: No, of course not.

Gantt range (x) axis format

Post by cannes » Thu Oct 28, 2010 9:40 am

Hello together,
i'm new to java and new to JFreeChart (Using Delphi/TeeChart till now)
My Problem is :
i'm drawing a Gantt Chart using Code following code:

Code: Select all

private JFreeChart createChart(final IntervalCategoryDataset dataset) {
        final JFreeChart chart = ChartFactory.createGanttChart(
                "Gantt Chart Demo", // chart title
                "Task", // domain axis label
                "Hour", // range axis label
                dataset, // data
                true, // include legend
                true, // tooltips
                false // urls
                );
return chart;
i fill my dataset from a ResultSet with:

Code: Select all

TaskSeries s1 = new TaskSeries("Scheduled");
 while (RS.next()) {
                if(s1.getTasks().size()<20){
                s1.add(new Task(RS.getString("FallNr"),
                        new SimpleTimePeriod(RS.getDate("AufZeit"),
                        RS.getDate("EntZeit"))));}               
            }
            IntervalCategoryDataset dataset = createDataset(s1);
            JFreeChart chart = createChart(dataset);
            ChartPanel chartPanel1 = new ChartPanel(chart);
            chartPanel1.setPreferredSize(new java.awt.Dimension(1000, 700));
            Anzeige anzeige = new Anzeige(null, true);
            anzeige.mypanel(chartPanel1);
            anzeige.show();        
    }
the IntervalCategoryDataset is created by:

Code: Select all

    private IntervalCategoryDataset createDataset(TaskSeries serie) {
        TaskSeriesCollection collection = new TaskSeriesCollection();
        collection.add(serie);
        return collection;
    }

My problem seems to be that the time axis is out of range.
First time on x axxis is 23:59:59:999 and last is 00:00:00:001
the timesintervals i want to Display begins at 00:05 to 02:00 (for example) and end between 1 to 3 hours later.

For me this seems to be an autorange problem how do i solve this ?

Sry for my bad english,

Thorsten

Locked