StatisticTimeseriesAdaptor.java from Tea Stats at Krugle
Show StatisticTimeseriesAdaptor.java syntax highlighted
/*
* This file is distributed under the GPL v2 as part of teastats site statistics package
* http://teastats.sourceforge.net
*/
package net.time4tea.webstats.graph;
import net.time4tea.webstats.statistic.Statistic;
import net.time4tea.webstats.statistic.memory.StatisticHashMap;
import org.jfree.data.time.Day;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
/**
* Originally richja Apr 16, 2006
*/
public class StatisticTimeseriesAdaptor {
TimeSeriesCollection collection = new TimeSeriesCollection();
public StatisticTimeseriesAdaptor(TimeSeriesCollection collection) {
this.collection = collection;
}
public void addCategory(StatisticHashMap hitter, String name) {
TimeSeries timeseries = new TimeSeries(name);
Day day = new Day();
for (int i = 0; i < 31; i++) {
Statistic statistic = hitter.get("" + i);
if (statistic != null) {
timeseries.add(day, statistic.getCount());
}
day = (Day) day.next();
}
collection.addSeries(timeseries);
}
}
See more files for this project here