JFreechart seems excellent thus far. I'm having a bit of a problem with creating a stackedxyareachart from a timetablexydataset right now though. It's almost assuredly a lack of understanding on my part but I would appreciate any information that might be able to set me straight.
What I'm tring to accomplish is to show the past 24 hours in 1 hour increments on the x-axis of the stackedxyarea chart. When I'm populating my timetablexydataset I add the tasks usint new Hour(task.getTimestamp() and 0 fill any hours that don't have data. What I can't get down, is to get the chart to consistently display the same x-axis (i.e., past 24 hours in 1 hour increments).
So far I get irregular x-axis values, sometimes it will display the past 24 hours in 2 hour increments, some times the past 20 hours, sometimes the past 14, sometimes the past 2 hours in 15 minute increments, etc.,
Here is what I have for my chart creation currently:
Code: Select all
...
NumberAxis yAxis = new NumberAxis();
DateAxis dateAxis = new DateAxis();
TimeTableXYDataset ttd = (TimeTableXYDataset)data; //data is passed into this method as a a general Dataset
XYPlot plot = new XYPlot(ttd, dateAxis, yAxis, new StackedXYAreaRenderer2());
((DateAxis)plot.getDomainAxis()).setAutoRange(false);
((DateAxis)plot.getDomainAxis()).configure();
return new JFreeChart(plot);
but all that seems to do is display 1 hour across the whole x-axis.
Unfortunately I don't presently have access to the developer guide and example code, but would very sincerely appreciate any guidance none the less.