StackedXYAreaChart, TimeTableXYDataset, and x axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
cmose
Posts: 5
Joined: Wed Mar 07, 2007 3:25 pm

StackedXYAreaChart, TimeTableXYDataset, and x axis

Post by cmose » Wed Mar 07, 2007 3:35 pm

Hello all,
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);
I've tried setting dateAxis.setTickUnit(new DateTickUnit(DateTickUnit.HOUR, 24));

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.

deepaliashwin
Posts: 2
Joined: Thu Mar 29, 2007 10:39 am
Contact:

Post by deepaliashwin » Thu Mar 29, 2007 10:58 am

Hi All,
I am facing problem of plotting x axis ,though i am plotting hh:mma wise but i want 12 am - 11 pm on x axis not the actual data .
i am using timeseries chart

Locked