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;
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();
}
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