Hello, I'm trying to display data on a XYBarChart using JFreechart. The chart should display points in time along with a count. Thus, if the user chooses Jan 25 and March 25th as the range, the chart should display data between those dates in certain intervals:
if the user chooses HOUR, then I create a collection of every hour from Jan 25 to March 10th, along with a correspond count. Naturally, this is quite a big collection. If the user chooses MONTH, then the user should see 3 months (and only 3 entries in the collection). If the user chooses DAY, then the user would only see about 60 entries. You see?
When I create the chart (using the code below for the dataset generation) it 'interpolates' the values. If I choose hours, it shows data by day with many bars in between each day (ie, 24 little bars inside the day). If I choose months, I still get the days for 2 months, but I get one giant block that covers all days of the month. If I choose DAY, it looks alright.
How can I get jfreecharts to stop interpolating values and just draw a chart with a 1:1 mapping to what data I give it. If I give it two entries for 2 months and give it a RegularTimePeriod of Month.class, show just two bars with two labels and two values. If I give it 1000 hours over the course of several months, then display every hour with a label and a count, and so on...
TimeSeries timeSeries = new TimeSeries(title, "Blah", "blah", clazz);
// clazz is one of Day.class, Month.class, Hour.class
for (final ReportRecord reportRecord : records) {
int count = reportRecord.getCount();
Date start = reportRecord.getDateRange().getStart();
RegularTimePeriod period = null;
switch (type) {
case DAY: period = new Day(start); break;
case MONTH: period = new Month(start); break;
case HOUR: period = new Hour(start); break;
}
timeSeries.add(new TimeSeriesDataItem(period, count));
}
return new TimeSeriesCollection(timeSeries);
Thank you, Josh