Example usage for org.jfree.data.time TimeSeries add

List of usage examples for org.jfree.data.time TimeSeries add

Introduction

In this page you can find the example usage for org.jfree.data.time TimeSeries add.

Prototype

public void add(RegularTimePeriod period, Number value) 

Source Link

Document

Adds a new data item to the series and sends a org.jfree.data.general.SeriesChangeEvent to all registered listeners.

Usage

From source file:org.jfree.chart.demo.DifferenceChartDemo2.java

/**
 * Creates a time series containing sunset times for London in 2004.
 *
 * @return a time series containing sunset times.
 *///from w w  w  .  ja  v  a  2 s .c o m
public TimeSeries createSunsetSeries() {
    final TimeSeries series = new TimeSeries("Sunset");

    series.add(new Day(1, 1, 2004), time(16, 0));
    series.add(new Day(2, 1, 2004), time(16, 1));
    series.add(new Day(3, 1, 2004), time(16, 2));
    series.add(new Day(4, 1, 2004), time(16, 3));
    series.add(new Day(5, 1, 2004), time(16, 4));
    series.add(new Day(6, 1, 2004), time(16, 5));
    series.add(new Day(7, 1, 2004), time(16, 7));
    series.add(new Day(8, 1, 2004), time(16, 8));
    series.add(new Day(9, 1, 2004), time(16, 9));
    series.add(new Day(10, 1, 2004), time(16, 11));
    series.add(new Day(11, 1, 2004), time(16, 12));
    series.add(new Day(12, 1, 2004), time(16, 13));
    series.add(new Day(13, 1, 2004), time(16, 15));
    series.add(new Day(14, 1, 2004), time(16, 16));
    series.add(new Day(15, 1, 2004), time(16, 18));
    series.add(new Day(16, 1, 2004), time(16, 19));
    series.add(new Day(17, 1, 2004), time(16, 21));
    series.add(new Day(18, 1, 2004), time(16, 22));
    series.add(new Day(19, 1, 2004), time(16, 24));
    series.add(new Day(20, 1, 2004), time(16, 26));
    series.add(new Day(21, 1, 2004), time(16, 27));
    series.add(new Day(22, 1, 2004), time(16, 29));
    series.add(new Day(23, 1, 2004), time(16, 31));
    series.add(new Day(24, 1, 2004), time(16, 32));
    series.add(new Day(25, 1, 2004), time(16, 34));
    series.add(new Day(26, 1, 2004), time(16, 36));
    series.add(new Day(27, 1, 2004), time(16, 38));
    series.add(new Day(28, 1, 2004), time(16, 39));
    series.add(new Day(29, 1, 2004), time(16, 41));
    series.add(new Day(30, 1, 2004), time(16, 43));
    series.add(new Day(31, 1, 2004), time(16, 45));

    series.add(new Day(1, 2, 2004), time(16, 47));
    series.add(new Day(2, 2, 2004), time(16, 48));
    series.add(new Day(3, 2, 2004), time(16, 50));
    series.add(new Day(4, 2, 2004), time(16, 52));
    series.add(new Day(5, 2, 2004), time(16, 54));
    series.add(new Day(6, 2, 2004), time(16, 56));
    series.add(new Day(7, 2, 2004), time(16, 57));
    series.add(new Day(8, 2, 2004), time(16, 59));
    series.add(new Day(9, 2, 2004), time(17, 1));
    series.add(new Day(10, 2, 2004), time(17, 3));
    series.add(new Day(11, 2, 2004), time(17, 5));
    series.add(new Day(12, 2, 2004), time(17, 7));
    series.add(new Day(13, 2, 2004), time(17, 8));
    series.add(new Day(14, 2, 2004), time(17, 10));
    series.add(new Day(15, 2, 2004), time(17, 12));
    series.add(new Day(16, 2, 2004), time(17, 14));
    series.add(new Day(17, 2, 2004), time(17, 16));
    series.add(new Day(18, 2, 2004), time(17, 17));
    series.add(new Day(19, 2, 2004), time(17, 19));
    series.add(new Day(20, 2, 2004), time(17, 21));
    series.add(new Day(21, 2, 2004), time(17, 23));
    series.add(new Day(22, 2, 2004), time(17, 25));
    series.add(new Day(23, 2, 2004), time(17, 27));
    series.add(new Day(24, 2, 2004), time(17, 28));
    series.add(new Day(25, 2, 2004), time(17, 30));
    series.add(new Day(26, 2, 2004), time(17, 32));
    series.add(new Day(27, 2, 2004), time(17, 34));
    series.add(new Day(28, 2, 2004), time(17, 35));
    series.add(new Day(29, 2, 2004), time(17, 37));

    series.add(new Day(1, 3, 2004), time(17, 39));
    series.add(new Day(2, 3, 2004), time(17, 41));
    series.add(new Day(3, 3, 2004), time(17, 43));
    series.add(new Day(4, 3, 2004), time(17, 44));
    series.add(new Day(5, 3, 2004), time(17, 46));
    series.add(new Day(6, 3, 2004), time(17, 48));
    series.add(new Day(7, 3, 2004), time(17, 50));
    series.add(new Day(8, 3, 2004), time(17, 51));
    series.add(new Day(9, 3, 2004), time(17, 53));
    series.add(new Day(10, 3, 2004), time(17, 55));
    series.add(new Day(11, 3, 2004), time(17, 56));
    series.add(new Day(12, 3, 2004), time(17, 58));
    series.add(new Day(13, 3, 2004), time(18, 0));
    series.add(new Day(14, 3, 2004), time(18, 2));
    series.add(new Day(15, 3, 2004), time(18, 3));
    series.add(new Day(16, 3, 2004), time(18, 5));
    series.add(new Day(17, 3, 2004), time(18, 7));
    series.add(new Day(18, 3, 2004), time(18, 8));
    series.add(new Day(19, 3, 2004), time(18, 10));
    series.add(new Day(20, 3, 2004), time(18, 12));
    series.add(new Day(21, 3, 2004), time(18, 13));
    series.add(new Day(22, 3, 2004), time(18, 15));
    series.add(new Day(23, 3, 2004), time(18, 17));
    series.add(new Day(24, 3, 2004), time(18, 19));
    series.add(new Day(25, 3, 2004), time(18, 20));
    series.add(new Day(26, 3, 2004), time(18, 22));
    series.add(new Day(27, 3, 2004), time(18, 24));
    series.add(new Day(28, 3, 2004), time(19, 25));
    series.add(new Day(29, 3, 2004), time(19, 27));
    series.add(new Day(30, 3, 2004), time(19, 29));
    series.add(new Day(31, 3, 2004), time(19, 30));

    series.add(new Day(1, 4, 2004), time(19, 32));
    series.add(new Day(2, 4, 2004), time(19, 34));
    series.add(new Day(3, 4, 2004), time(19, 35));
    series.add(new Day(4, 4, 2004), time(19, 37));
    series.add(new Day(5, 4, 2004), time(19, 39));
    series.add(new Day(6, 4, 2004), time(19, 40));
    series.add(new Day(7, 4, 2004), time(19, 42));
    series.add(new Day(8, 4, 2004), time(19, 44));
    series.add(new Day(9, 4, 2004), time(19, 45));
    series.add(new Day(10, 4, 2004), time(19, 47));
    series.add(new Day(11, 4, 2004), time(19, 49));
    series.add(new Day(12, 4, 2004), time(19, 50));
    series.add(new Day(13, 4, 2004), time(19, 52));
    series.add(new Day(14, 4, 2004), time(19, 54));
    series.add(new Day(15, 4, 2004), time(19, 55));
    series.add(new Day(16, 4, 2004), time(19, 57));
    series.add(new Day(17, 4, 2004), time(19, 59));
    series.add(new Day(18, 4, 2004), time(20, 0));
    series.add(new Day(19, 4, 2004), time(20, 2));
    series.add(new Day(20, 4, 2004), time(20, 4));
    series.add(new Day(21, 4, 2004), time(20, 5));
    series.add(new Day(22, 4, 2004), time(20, 7));
    series.add(new Day(23, 4, 2004), time(20, 9));
    series.add(new Day(24, 4, 2004), time(20, 10));
    series.add(new Day(25, 4, 2004), time(20, 12));
    series.add(new Day(26, 4, 2004), time(20, 14));
    series.add(new Day(27, 4, 2004), time(20, 15));
    series.add(new Day(28, 4, 2004), time(20, 17));
    series.add(new Day(29, 4, 2004), time(20, 19));
    series.add(new Day(30, 4, 2004), time(20, 20));

    series.add(new Day(1, 5, 2004), time(20, 22));
    series.add(new Day(2, 5, 2004), time(20, 24));
    series.add(new Day(3, 5, 2004), time(20, 25));
    series.add(new Day(4, 5, 2004), time(20, 27));
    series.add(new Day(5, 5, 2004), time(20, 28));
    series.add(new Day(6, 5, 2004), time(20, 30));
    series.add(new Day(7, 5, 2004), time(20, 32));
    series.add(new Day(8, 5, 2004), time(20, 33));
    series.add(new Day(9, 5, 2004), time(20, 35));
    series.add(new Day(10, 5, 2004), time(20, 36));
    series.add(new Day(11, 5, 2004), time(20, 38));
    series.add(new Day(12, 5, 2004), time(20, 40));
    series.add(new Day(13, 5, 2004), time(20, 41));
    series.add(new Day(14, 5, 2004), time(20, 43));
    series.add(new Day(15, 5, 2004), time(20, 44));
    series.add(new Day(16, 5, 2004), time(20, 46));
    series.add(new Day(17, 5, 2004), time(20, 47));
    series.add(new Day(18, 5, 2004), time(20, 49));
    series.add(new Day(19, 5, 2004), time(20, 50));
    series.add(new Day(20, 5, 2004), time(20, 51));
    series.add(new Day(21, 5, 2004), time(20, 53));
    series.add(new Day(22, 5, 2004), time(20, 54));
    series.add(new Day(23, 5, 2004), time(20, 56));
    series.add(new Day(24, 5, 2004), time(20, 57));
    series.add(new Day(25, 5, 2004), time(20, 58));
    series.add(new Day(26, 5, 2004), time(21, 0));
    series.add(new Day(27, 5, 2004), time(21, 1));
    series.add(new Day(28, 5, 2004), time(21, 2));
    series.add(new Day(29, 5, 2004), time(21, 3));
    series.add(new Day(30, 5, 2004), time(21, 4));
    series.add(new Day(31, 5, 2004), time(21, 6));

    series.add(new Day(1, 6, 2004), time(21, 7));
    series.add(new Day(2, 6, 2004), time(21, 8));
    series.add(new Day(3, 6, 2004), time(21, 9));
    series.add(new Day(4, 6, 2004), time(21, 10));
    series.add(new Day(5, 6, 2004), time(21, 11));
    series.add(new Day(6, 6, 2004), time(21, 12));
    series.add(new Day(7, 6, 2004), time(21, 13));
    series.add(new Day(8, 6, 2004), time(21, 13));
    series.add(new Day(9, 6, 2004), time(21, 14));
    series.add(new Day(10, 6, 2004), time(21, 15));
    series.add(new Day(11, 6, 2004), time(21, 16));
    series.add(new Day(12, 6, 2004), time(21, 16));
    series.add(new Day(13, 6, 2004), time(21, 17));
    series.add(new Day(14, 6, 2004), time(21, 18));
    series.add(new Day(15, 6, 2004), time(21, 18));
    series.add(new Day(16, 6, 2004), time(21, 19));
    series.add(new Day(17, 6, 2004), time(21, 19));
    series.add(new Day(18, 6, 2004), time(21, 19));
    series.add(new Day(19, 6, 2004), time(21, 20));
    series.add(new Day(20, 6, 2004), time(21, 20));
    series.add(new Day(21, 6, 2004), time(21, 20));
    series.add(new Day(22, 6, 2004), time(21, 21));
    series.add(new Day(23, 6, 2004), time(21, 21));
    series.add(new Day(24, 6, 2004), time(21, 21));
    series.add(new Day(25, 6, 2004), time(21, 21));
    series.add(new Day(26, 6, 2004), time(21, 21));
    series.add(new Day(27, 6, 2004), time(21, 21));
    series.add(new Day(28, 6, 2004), time(21, 21));
    series.add(new Day(29, 6, 2004), time(21, 21));
    series.add(new Day(30, 6, 2004), time(21, 21));

    series.add(new Day(1, 7, 2004), time(21, 20));
    series.add(new Day(2, 7, 2004), time(21, 20));
    series.add(new Day(3, 7, 2004), time(21, 19));
    series.add(new Day(4, 7, 2004), time(21, 19));
    series.add(new Day(5, 7, 2004), time(21, 18));
    series.add(new Day(6, 7, 2004), time(21, 18));
    series.add(new Day(7, 7, 2004), time(21, 17));
    series.add(new Day(8, 7, 2004), time(21, 17));
    series.add(new Day(9, 7, 2004), time(21, 16));
    series.add(new Day(10, 7, 2004), time(21, 15));
    series.add(new Day(11, 7, 2004), time(21, 14));
    series.add(new Day(12, 7, 2004), time(21, 14));
    series.add(new Day(13, 7, 2004), time(21, 13));
    series.add(new Day(14, 7, 2004), time(21, 12));
    series.add(new Day(15, 7, 2004), time(21, 11));
    series.add(new Day(16, 7, 2004), time(21, 10));
    series.add(new Day(17, 7, 2004), time(21, 9));
    series.add(new Day(18, 7, 2004), time(21, 8));
    series.add(new Day(19, 7, 2004), time(21, 7));
    series.add(new Day(20, 7, 2004), time(21, 5));
    series.add(new Day(21, 7, 2004), time(21, 4));
    series.add(new Day(22, 7, 2004), time(21, 3));
    series.add(new Day(23, 7, 2004), time(21, 2));
    series.add(new Day(24, 7, 2004), time(21, 0));
    series.add(new Day(25, 7, 2004), time(20, 59));
    series.add(new Day(26, 7, 2004), time(20, 58));
    series.add(new Day(27, 7, 2004), time(20, 56));
    series.add(new Day(28, 7, 2004), time(20, 55));
    series.add(new Day(29, 7, 2004), time(20, 53));
    series.add(new Day(30, 7, 2004), time(20, 52));
    series.add(new Day(31, 7, 2004), time(20, 50));

    series.add(new Day(1, 8, 2004), time(20, 48));
    series.add(new Day(2, 8, 2004), time(20, 47));
    series.add(new Day(3, 8, 2004), time(20, 45));
    series.add(new Day(4, 8, 2004), time(20, 43));
    series.add(new Day(5, 8, 2004), time(20, 42));
    series.add(new Day(6, 8, 2004), time(20, 40));
    series.add(new Day(7, 8, 2004), time(20, 38));
    series.add(new Day(8, 8, 2004), time(20, 36));
    series.add(new Day(9, 8, 2004), time(20, 34));
    series.add(new Day(10, 8, 2004), time(20, 33));
    series.add(new Day(11, 8, 2004), time(20, 31));
    series.add(new Day(12, 8, 2004), time(20, 29));
    series.add(new Day(13, 8, 2004), time(20, 27));
    series.add(new Day(14, 8, 2004), time(20, 25));
    series.add(new Day(15, 8, 2004), time(20, 23));
    series.add(new Day(16, 8, 2004), time(20, 21));
    series.add(new Day(17, 8, 2004), time(20, 19));
    series.add(new Day(18, 8, 2004), time(20, 17));
    series.add(new Day(19, 8, 2004), time(20, 15));
    series.add(new Day(20, 8, 2004), time(20, 13));
    series.add(new Day(21, 8, 2004), time(20, 11));
    series.add(new Day(22, 8, 2004), time(20, 9));
    series.add(new Day(23, 8, 2004), time(20, 7));
    series.add(new Day(24, 8, 2004), time(20, 4));
    series.add(new Day(25, 8, 2004), time(20, 2));
    series.add(new Day(26, 8, 2004), time(20, 0));
    series.add(new Day(27, 8, 2004), time(19, 58));
    series.add(new Day(28, 8, 2004), time(19, 56));
    series.add(new Day(29, 8, 2004), time(19, 54));
    series.add(new Day(30, 8, 2004), time(19, 51));
    series.add(new Day(31, 8, 2004), time(19, 49));

    series.add(new Day(1, 9, 2004), time(19, 47));
    series.add(new Day(2, 9, 2004), time(19, 45));
    series.add(new Day(3, 9, 2004), time(19, 42));
    series.add(new Day(4, 9, 2004), time(19, 40));
    series.add(new Day(5, 9, 2004), time(19, 38));
    series.add(new Day(6, 9, 2004), time(19, 36));
    series.add(new Day(7, 9, 2004), time(19, 33));
    series.add(new Day(8, 9, 2004), time(19, 31));
    series.add(new Day(9, 9, 2004), time(19, 29));
    series.add(new Day(10, 9, 2004), time(19, 27));
    series.add(new Day(11, 9, 2004), time(19, 24));
    series.add(new Day(12, 9, 2004), time(19, 22));
    series.add(new Day(13, 9, 2004), time(19, 20));
    series.add(new Day(14, 9, 2004), time(19, 17));
    series.add(new Day(15, 9, 2004), time(19, 15));
    series.add(new Day(16, 9, 2004), time(19, 13));
    series.add(new Day(17, 9, 2004), time(19, 11));
    series.add(new Day(18, 9, 2004), time(19, 8));
    series.add(new Day(19, 9, 2004), time(19, 6));
    series.add(new Day(20, 9, 2004), time(19, 4));
    series.add(new Day(21, 9, 2004), time(19, 1));
    series.add(new Day(22, 9, 2004), time(18, 59));
    series.add(new Day(23, 9, 2004), time(18, 57));
    series.add(new Day(24, 9, 2004), time(18, 54));
    series.add(new Day(25, 9, 2004), time(18, 52));
    series.add(new Day(26, 9, 2004), time(18, 50));
    series.add(new Day(27, 9, 2004), time(18, 47));
    series.add(new Day(28, 9, 2004), time(18, 45));
    series.add(new Day(29, 9, 2004), time(18, 43));
    series.add(new Day(30, 9, 2004), time(18, 41));

    series.add(new Day(1, 10, 2004), time(18, 38));
    series.add(new Day(2, 10, 2004), time(18, 36));
    series.add(new Day(3, 10, 2004), time(18, 34));
    series.add(new Day(4, 10, 2004), time(18, 31));
    series.add(new Day(5, 10, 2004), time(18, 29));
    series.add(new Day(6, 10, 2004), time(18, 27));
    series.add(new Day(7, 10, 2004), time(18, 25));
    series.add(new Day(8, 10, 2004), time(18, 22));
    series.add(new Day(9, 10, 2004), time(18, 20));
    series.add(new Day(10, 10, 2004), time(18, 18));
    series.add(new Day(11, 10, 2004), time(18, 16));
    series.add(new Day(12, 10, 2004), time(18, 14));
    series.add(new Day(13, 10, 2004), time(18, 11));
    series.add(new Day(14, 10, 2004), time(18, 9));
    series.add(new Day(15, 10, 2004), time(18, 7));
    series.add(new Day(16, 10, 2004), time(18, 5));
    series.add(new Day(17, 10, 2004), time(18, 3));
    series.add(new Day(18, 10, 2004), time(18, 1));
    series.add(new Day(19, 10, 2004), time(17, 59));
    series.add(new Day(20, 10, 2004), time(17, 57));
    series.add(new Day(21, 10, 2004), time(17, 55));
    series.add(new Day(22, 10, 2004), time(17, 53));
    series.add(new Day(23, 10, 2004), time(17, 50));
    series.add(new Day(24, 10, 2004), time(17, 48));
    series.add(new Day(25, 10, 2004), time(17, 46));
    series.add(new Day(26, 10, 2004), time(17, 45));
    series.add(new Day(27, 10, 2004), time(17, 43));
    series.add(new Day(28, 10, 2004), time(17, 41));
    series.add(new Day(29, 10, 2004), time(17, 39));
    series.add(new Day(30, 10, 2004), time(17, 37));
    series.add(new Day(31, 10, 2004), time(16, 35));

    series.add(new Day(1, 11, 2004), time(16, 33));
    series.add(new Day(2, 11, 2004), time(16, 31));
    series.add(new Day(3, 11, 2004), time(16, 30));
    series.add(new Day(4, 11, 2004), time(16, 28));
    series.add(new Day(5, 11, 2004), time(16, 26));
    series.add(new Day(6, 11, 2004), time(16, 24));
    series.add(new Day(7, 11, 2004), time(16, 23));
    series.add(new Day(8, 11, 2004), time(16, 21));
    series.add(new Day(9, 11, 2004), time(16, 20));
    series.add(new Day(10, 11, 2004), time(16, 18));
    series.add(new Day(11, 11, 2004), time(16, 16));
    series.add(new Day(12, 11, 2004), time(16, 15));
    series.add(new Day(13, 11, 2004), time(16, 13));
    series.add(new Day(14, 11, 2004), time(16, 12));
    series.add(new Day(15, 11, 2004), time(16, 11));
    series.add(new Day(16, 11, 2004), time(16, 9));
    series.add(new Day(17, 11, 2004), time(16, 8));
    series.add(new Day(18, 11, 2004), time(16, 7));
    series.add(new Day(19, 11, 2004), time(16, 5));
    series.add(new Day(20, 11, 2004), time(16, 4));
    series.add(new Day(21, 11, 2004), time(16, 3));
    series.add(new Day(22, 11, 2004), time(16, 2));
    series.add(new Day(23, 11, 2004), time(16, 1));
    series.add(new Day(24, 11, 2004), time(16, 0));
    series.add(new Day(25, 11, 2004), time(15, 59));
    series.add(new Day(26, 11, 2004), time(15, 58));
    series.add(new Day(27, 11, 2004), time(15, 57));
    series.add(new Day(28, 11, 2004), time(15, 56));
    series.add(new Day(29, 11, 2004), time(15, 56));
    series.add(new Day(30, 11, 2004), time(15, 55));

    series.add(new Day(1, 12, 2004), time(15, 54));
    series.add(new Day(2, 12, 2004), time(15, 54));
    series.add(new Day(3, 12, 2004), time(15, 53));
    series.add(new Day(4, 12, 2004), time(15, 53));
    series.add(new Day(5, 12, 2004), time(15, 52));
    series.add(new Day(6, 12, 2004), time(15, 52));
    series.add(new Day(7, 12, 2004), time(15, 51));
    series.add(new Day(8, 12, 2004), time(15, 51));
    series.add(new Day(9, 12, 2004), time(15, 51));
    series.add(new Day(10, 12, 2004), time(15, 51));
    series.add(new Day(11, 12, 2004), time(15, 50));
    series.add(new Day(12, 12, 2004), time(15, 50));
    series.add(new Day(13, 12, 2004), time(15, 50));
    series.add(new Day(14, 12, 2004), time(15, 50));
    series.add(new Day(15, 12, 2004), time(15, 51));
    series.add(new Day(16, 12, 2004), time(15, 51));
    series.add(new Day(17, 12, 2004), time(15, 51));
    series.add(new Day(18, 12, 2004), time(15, 51));
    series.add(new Day(19, 12, 2004), time(15, 51));
    series.add(new Day(20, 12, 2004), time(15, 52));
    series.add(new Day(21, 12, 2004), time(15, 52));
    series.add(new Day(22, 12, 2004), time(15, 53));
    series.add(new Day(23, 12, 2004), time(15, 53));
    series.add(new Day(24, 12, 2004), time(15, 54));
    series.add(new Day(25, 12, 2004), time(15, 55));
    series.add(new Day(26, 12, 2004), time(15, 55));
    series.add(new Day(27, 12, 2004), time(15, 56));
    series.add(new Day(28, 12, 2004), time(15, 57));
    series.add(new Day(29, 12, 2004), time(15, 58));
    series.add(new Day(30, 12, 2004), time(15, 59));
    series.add(new Day(31, 12, 2004), time(16, 0));

    return series;

}

From source file:org.jfree.chart.demo.DifferenceChartDemo2.java

/**
 * Creates a time series containing sunrise times for London in 2004.
 *
 * @return a time series containing sunrise times.
 *///from w w  w  .  ja  v  a2  s  . c o m
public TimeSeries createSunriseSeries() {

    final TimeSeries series = new TimeSeries("Sunrise");

    series.add(new Day(1, 1, 2004), time(8, 5));
    series.add(new Day(2, 1, 2004), time(8, 5));
    series.add(new Day(3, 1, 2004), time(8, 5));
    series.add(new Day(4, 1, 2004), time(8, 5));
    series.add(new Day(5, 1, 2004), time(8, 5));
    series.add(new Day(6, 1, 2004), time(8, 4));
    series.add(new Day(7, 1, 2004), time(8, 4));
    series.add(new Day(8, 1, 2004), time(8, 4));
    series.add(new Day(9, 1, 2004), time(8, 3));
    series.add(new Day(10, 1, 2004), time(8, 3));
    series.add(new Day(11, 1, 2004), time(8, 2));
    series.add(new Day(12, 1, 2004), time(8, 1));
    series.add(new Day(13, 1, 2004), time(8, 1));
    series.add(new Day(14, 1, 2004), time(8, 0));
    series.add(new Day(15, 1, 2004), time(7, 59));
    series.add(new Day(16, 1, 2004), time(7, 58));
    series.add(new Day(17, 1, 2004), time(7, 58));
    series.add(new Day(18, 1, 2004), time(7, 57));
    series.add(new Day(19, 1, 2004), time(7, 56));
    series.add(new Day(20, 1, 2004), time(7, 55));
    series.add(new Day(21, 1, 2004), time(7, 54));
    series.add(new Day(22, 1, 2004), time(7, 53));
    series.add(new Day(23, 1, 2004), time(7, 51));
    series.add(new Day(24, 1, 2004), time(7, 50));
    series.add(new Day(25, 1, 2004), time(7, 49));
    series.add(new Day(26, 1, 2004), time(7, 48));
    series.add(new Day(27, 1, 2004), time(7, 46));
    series.add(new Day(28, 1, 2004), time(7, 45));
    series.add(new Day(29, 1, 2004), time(7, 44));
    series.add(new Day(30, 1, 2004), time(7, 42));
    series.add(new Day(31, 1, 2004), time(7, 41));

    series.add(new Day(1, 2, 2004), time(7, 39));
    series.add(new Day(2, 2, 2004), time(7, 38));
    series.add(new Day(3, 2, 2004), time(7, 36));
    series.add(new Day(4, 2, 2004), time(7, 35));
    series.add(new Day(5, 2, 2004), time(7, 33));
    series.add(new Day(6, 2, 2004), time(7, 31));
    series.add(new Day(7, 2, 2004), time(7, 30));
    series.add(new Day(8, 2, 2004), time(7, 28));
    series.add(new Day(9, 2, 2004), time(7, 26));
    series.add(new Day(10, 2, 2004), time(7, 25));
    series.add(new Day(11, 2, 2004), time(7, 23));
    series.add(new Day(12, 2, 2004), time(7, 21));
    series.add(new Day(13, 2, 2004), time(7, 19));
    series.add(new Day(14, 2, 2004), time(7, 17));
    series.add(new Day(15, 2, 2004), time(7, 15));
    series.add(new Day(16, 2, 2004), time(7, 13));
    series.add(new Day(17, 2, 2004), time(7, 11));
    series.add(new Day(18, 2, 2004), time(7, 10));
    series.add(new Day(19, 2, 2004), time(7, 8));
    series.add(new Day(20, 2, 2004), time(7, 6));
    series.add(new Day(21, 2, 2004), time(7, 4));
    series.add(new Day(22, 2, 2004), time(7, 2));
    series.add(new Day(23, 2, 2004), time(6, 59));
    series.add(new Day(24, 2, 2004), time(6, 57));
    series.add(new Day(25, 2, 2004), time(6, 55));
    series.add(new Day(26, 2, 2004), time(6, 53));
    series.add(new Day(27, 2, 2004), time(6, 51));
    series.add(new Day(28, 2, 2004), time(6, 49));
    series.add(new Day(29, 2, 2004), time(6, 47));

    series.add(new Day(1, 3, 2004), time(6, 45));
    series.add(new Day(2, 3, 2004), time(6, 43));
    series.add(new Day(3, 3, 2004), time(6, 40));
    series.add(new Day(4, 3, 2004), time(6, 38));
    series.add(new Day(5, 3, 2004), time(6, 36));
    series.add(new Day(6, 3, 2004), time(6, 34));
    series.add(new Day(7, 3, 2004), time(6, 32));
    series.add(new Day(8, 3, 2004), time(6, 29));
    series.add(new Day(9, 3, 2004), time(6, 27));
    series.add(new Day(10, 3, 2004), time(6, 25));
    series.add(new Day(11, 3, 2004), time(6, 23));
    series.add(new Day(12, 3, 2004), time(6, 20));
    series.add(new Day(13, 3, 2004), time(6, 18));
    series.add(new Day(14, 3, 2004), time(6, 16));
    series.add(new Day(15, 3, 2004), time(6, 14));
    series.add(new Day(16, 3, 2004), time(6, 11));
    series.add(new Day(17, 3, 2004), time(6, 9));
    series.add(new Day(18, 3, 2004), time(6, 7));
    series.add(new Day(19, 3, 2004), time(6, 5));
    series.add(new Day(20, 3, 2004), time(6, 2));
    series.add(new Day(21, 3, 2004), time(6, 0));
    series.add(new Day(22, 3, 2004), time(5, 58));
    series.add(new Day(23, 3, 2004), time(5, 55));
    series.add(new Day(24, 3, 2004), time(5, 53));
    series.add(new Day(25, 3, 2004), time(5, 51));
    series.add(new Day(26, 3, 2004), time(5, 49));
    series.add(new Day(27, 3, 2004), time(5, 46));
    series.add(new Day(28, 3, 2004), time(6, 44));
    series.add(new Day(29, 3, 2004), time(6, 42));
    series.add(new Day(30, 3, 2004), time(6, 39));
    series.add(new Day(31, 3, 2004), time(6, 37));

    series.add(new Day(1, 4, 2004), time(6, 35));
    series.add(new Day(2, 4, 2004), time(6, 33));
    series.add(new Day(3, 4, 2004), time(6, 30));
    series.add(new Day(4, 4, 2004), time(6, 28));
    series.add(new Day(5, 4, 2004), time(6, 26));
    series.add(new Day(6, 4, 2004), time(6, 24));
    series.add(new Day(7, 4, 2004), time(6, 21));
    series.add(new Day(8, 4, 2004), time(6, 19));
    series.add(new Day(9, 4, 2004), time(6, 17));
    series.add(new Day(10, 4, 2004), time(6, 15));
    series.add(new Day(11, 4, 2004), time(6, 12));
    series.add(new Day(12, 4, 2004), time(6, 10));
    series.add(new Day(13, 4, 2004), time(6, 8));
    series.add(new Day(14, 4, 2004), time(6, 6));
    series.add(new Day(15, 4, 2004), time(6, 4));
    series.add(new Day(16, 4, 2004), time(6, 2));
    series.add(new Day(17, 4, 2004), time(5, 59));
    series.add(new Day(18, 4, 2004), time(5, 57));
    series.add(new Day(19, 4, 2004), time(5, 55));
    series.add(new Day(20, 4, 2004), time(5, 53));
    series.add(new Day(21, 4, 2004), time(5, 51));
    series.add(new Day(22, 4, 2004), time(5, 49));
    series.add(new Day(23, 4, 2004), time(5, 47));
    series.add(new Day(24, 4, 2004), time(5, 45));
    series.add(new Day(25, 4, 2004), time(5, 43));
    series.add(new Day(26, 4, 2004), time(5, 41));
    series.add(new Day(27, 4, 2004), time(5, 39));
    series.add(new Day(28, 4, 2004), time(5, 37));
    series.add(new Day(29, 4, 2004), time(5, 35));
    series.add(new Day(30, 4, 2004), time(5, 33));

    series.add(new Day(1, 5, 2004), time(5, 31));
    series.add(new Day(2, 5, 2004), time(5, 29));
    series.add(new Day(3, 5, 2004), time(5, 28));
    series.add(new Day(4, 5, 2004), time(5, 26));
    series.add(new Day(5, 5, 2004), time(5, 24));
    series.add(new Day(6, 5, 2004), time(5, 22));
    series.add(new Day(7, 5, 2004), time(5, 20));
    series.add(new Day(8, 5, 2004), time(5, 19));
    series.add(new Day(9, 5, 2004), time(5, 17));
    series.add(new Day(10, 5, 2004), time(5, 15));
    series.add(new Day(11, 5, 2004), time(5, 14));
    series.add(new Day(12, 5, 2004), time(5, 12));
    series.add(new Day(13, 5, 2004), time(5, 11));
    series.add(new Day(14, 5, 2004), time(5, 9));
    series.add(new Day(15, 5, 2004), time(5, 8));
    series.add(new Day(16, 5, 2004), time(5, 6));
    series.add(new Day(17, 5, 2004), time(5, 5));
    series.add(new Day(18, 5, 2004), time(5, 3));
    series.add(new Day(19, 5, 2004), time(5, 2));
    series.add(new Day(20, 5, 2004), time(5, 1));
    series.add(new Day(21, 5, 2004), time(4, 59));
    series.add(new Day(22, 5, 2004), time(4, 58));
    series.add(new Day(23, 5, 2004), time(4, 57));
    series.add(new Day(24, 5, 2004), time(4, 56));
    series.add(new Day(25, 5, 2004), time(4, 55));
    series.add(new Day(26, 5, 2004), time(4, 53));
    series.add(new Day(27, 5, 2004), time(4, 52));
    series.add(new Day(28, 5, 2004), time(4, 51));
    series.add(new Day(29, 5, 2004), time(4, 50));
    series.add(new Day(30, 5, 2004), time(4, 50));
    series.add(new Day(31, 5, 2004), time(4, 49));

    series.add(new Day(1, 6, 2004), time(4, 48));
    series.add(new Day(2, 6, 2004), time(4, 47));
    series.add(new Day(3, 6, 2004), time(4, 46));
    series.add(new Day(4, 6, 2004), time(4, 46));
    series.add(new Day(5, 6, 2004), time(4, 45));
    series.add(new Day(6, 6, 2004), time(4, 45));
    series.add(new Day(7, 6, 2004), time(4, 44));
    series.add(new Day(8, 6, 2004), time(4, 44));
    series.add(new Day(9, 6, 2004), time(4, 43));
    series.add(new Day(10, 6, 2004), time(4, 43));
    series.add(new Day(11, 6, 2004), time(4, 42));
    series.add(new Day(12, 6, 2004), time(4, 42));
    series.add(new Day(13, 6, 2004), time(4, 42));
    series.add(new Day(14, 6, 2004), time(4, 42));
    series.add(new Day(15, 6, 2004), time(4, 42));
    series.add(new Day(16, 6, 2004), time(4, 42));
    series.add(new Day(17, 6, 2004), time(4, 42));
    series.add(new Day(18, 6, 2004), time(4, 42));
    series.add(new Day(19, 6, 2004), time(4, 42));
    series.add(new Day(20, 6, 2004), time(4, 42));
    series.add(new Day(21, 6, 2004), time(4, 42));
    series.add(new Day(22, 6, 2004), time(4, 42));
    series.add(new Day(23, 6, 2004), time(4, 43));
    series.add(new Day(24, 6, 2004), time(4, 43));
    series.add(new Day(25, 6, 2004), time(4, 43));
    series.add(new Day(26, 6, 2004), time(4, 44));
    series.add(new Day(27, 6, 2004), time(4, 44));
    series.add(new Day(28, 6, 2004), time(4, 45));
    series.add(new Day(29, 6, 2004), time(4, 45));
    series.add(new Day(30, 6, 2004), time(4, 46));

    series.add(new Day(1, 7, 2004), time(4, 47));
    series.add(new Day(2, 7, 2004), time(4, 47));
    series.add(new Day(3, 7, 2004), time(4, 48));
    series.add(new Day(4, 7, 2004), time(4, 49));
    series.add(new Day(5, 7, 2004), time(4, 50));
    series.add(new Day(6, 7, 2004), time(4, 51));
    series.add(new Day(7, 7, 2004), time(4, 51));
    series.add(new Day(8, 7, 2004), time(4, 52));
    series.add(new Day(9, 7, 2004), time(4, 53));
    series.add(new Day(10, 7, 2004), time(4, 54));
    series.add(new Day(11, 7, 2004), time(4, 55));
    series.add(new Day(12, 7, 2004), time(4, 57));
    series.add(new Day(13, 7, 2004), time(4, 58));
    series.add(new Day(14, 7, 2004), time(4, 59));
    series.add(new Day(15, 7, 2004), time(5, 0));
    series.add(new Day(16, 7, 2004), time(5, 1));
    series.add(new Day(17, 7, 2004), time(5, 2));
    series.add(new Day(18, 7, 2004), time(5, 4));
    series.add(new Day(19, 7, 2004), time(5, 5));
    series.add(new Day(20, 7, 2004), time(5, 6));
    series.add(new Day(21, 7, 2004), time(5, 8));
    series.add(new Day(22, 7, 2004), time(5, 9));
    series.add(new Day(23, 7, 2004), time(5, 10));
    series.add(new Day(24, 7, 2004), time(5, 12));
    series.add(new Day(25, 7, 2004), time(5, 13));
    series.add(new Day(26, 7, 2004), time(5, 14));
    series.add(new Day(27, 7, 2004), time(5, 16));
    series.add(new Day(28, 7, 2004), time(5, 17));
    series.add(new Day(29, 7, 2004), time(5, 19));
    series.add(new Day(30, 7, 2004), time(5, 20));
    series.add(new Day(31, 7, 2004), time(5, 22));

    series.add(new Day(1, 8, 2004), time(5, 23));
    series.add(new Day(2, 8, 2004), time(5, 25));
    series.add(new Day(3, 8, 2004), time(5, 26));
    series.add(new Day(4, 8, 2004), time(5, 28));
    series.add(new Day(5, 8, 2004), time(5, 29));
    series.add(new Day(6, 8, 2004), time(5, 31));
    series.add(new Day(7, 8, 2004), time(5, 32));
    series.add(new Day(8, 8, 2004), time(5, 34));
    series.add(new Day(9, 8, 2004), time(5, 36));
    series.add(new Day(10, 8, 2004), time(5, 37));
    series.add(new Day(11, 8, 2004), time(5, 39));
    series.add(new Day(12, 8, 2004), time(5, 40));
    series.add(new Day(13, 8, 2004), time(5, 42));
    series.add(new Day(14, 8, 2004), time(5, 43));
    series.add(new Day(15, 8, 2004), time(5, 45));
    series.add(new Day(16, 8, 2004), time(5, 47));
    series.add(new Day(17, 8, 2004), time(5, 48));
    series.add(new Day(18, 8, 2004), time(5, 50));
    series.add(new Day(19, 8, 2004), time(5, 51));
    series.add(new Day(20, 8, 2004), time(5, 53));
    series.add(new Day(21, 8, 2004), time(5, 55));
    series.add(new Day(22, 8, 2004), time(5, 56));
    series.add(new Day(23, 8, 2004), time(5, 58));
    series.add(new Day(24, 8, 2004), time(5, 59));
    series.add(new Day(25, 8, 2004), time(6, 1));
    series.add(new Day(26, 8, 2004), time(6, 3));
    series.add(new Day(27, 8, 2004), time(6, 4));
    series.add(new Day(28, 8, 2004), time(6, 6));
    series.add(new Day(29, 8, 2004), time(6, 7));
    series.add(new Day(30, 8, 2004), time(6, 9));
    series.add(new Day(31, 8, 2004), time(6, 10));

    series.add(new Day(1, 9, 2004), time(6, 12));
    series.add(new Day(2, 9, 2004), time(6, 14));
    series.add(new Day(3, 9, 2004), time(6, 15));
    series.add(new Day(4, 9, 2004), time(6, 17));
    series.add(new Day(5, 9, 2004), time(6, 18));
    series.add(new Day(6, 9, 2004), time(6, 20));
    series.add(new Day(7, 9, 2004), time(6, 22));
    series.add(new Day(8, 9, 2004), time(6, 23));
    series.add(new Day(9, 9, 2004), time(6, 25));
    series.add(new Day(10, 9, 2004), time(6, 26));
    series.add(new Day(11, 9, 2004), time(6, 28));
    series.add(new Day(12, 9, 2004), time(6, 30));
    series.add(new Day(13, 9, 2004), time(6, 31));
    series.add(new Day(14, 9, 2004), time(6, 33));
    series.add(new Day(15, 9, 2004), time(6, 34));
    series.add(new Day(16, 9, 2004), time(6, 36));
    series.add(new Day(17, 9, 2004), time(6, 38));
    series.add(new Day(18, 9, 2004), time(6, 39));
    series.add(new Day(19, 9, 2004), time(6, 41));
    series.add(new Day(20, 9, 2004), time(6, 42));
    series.add(new Day(21, 9, 2004), time(6, 44));
    series.add(new Day(22, 9, 2004), time(6, 46));
    series.add(new Day(23, 9, 2004), time(6, 47));
    series.add(new Day(24, 9, 2004), time(6, 49));
    series.add(new Day(25, 9, 2004), time(6, 50));
    series.add(new Day(26, 9, 2004), time(6, 52));
    series.add(new Day(27, 9, 2004), time(6, 54));
    series.add(new Day(28, 9, 2004), time(6, 55));
    series.add(new Day(29, 9, 2004), time(6, 57));
    series.add(new Day(30, 9, 2004), time(6, 58));

    series.add(new Day(1, 10, 2004), time(7, 0));
    series.add(new Day(2, 10, 2004), time(7, 2));
    series.add(new Day(3, 10, 2004), time(7, 3));
    series.add(new Day(4, 10, 2004), time(7, 5));
    series.add(new Day(5, 10, 2004), time(7, 7));
    series.add(new Day(6, 10, 2004), time(7, 8));
    series.add(new Day(7, 10, 2004), time(7, 10));
    series.add(new Day(8, 10, 2004), time(7, 12));
    series.add(new Day(9, 10, 2004), time(7, 13));
    series.add(new Day(10, 10, 2004), time(7, 15));
    series.add(new Day(11, 10, 2004), time(7, 17));
    series.add(new Day(12, 10, 2004), time(7, 18));
    series.add(new Day(13, 10, 2004), time(7, 20));
    series.add(new Day(14, 10, 2004), time(7, 22));
    series.add(new Day(15, 10, 2004), time(7, 23));
    series.add(new Day(16, 10, 2004), time(7, 25));
    series.add(new Day(17, 10, 2004), time(7, 27));
    series.add(new Day(18, 10, 2004), time(7, 29));
    series.add(new Day(19, 10, 2004), time(7, 30));
    series.add(new Day(20, 10, 2004), time(7, 32));
    series.add(new Day(21, 10, 2004), time(7, 34));
    series.add(new Day(22, 10, 2004), time(7, 35));
    series.add(new Day(23, 10, 2004), time(7, 37));
    series.add(new Day(24, 10, 2004), time(7, 39));
    series.add(new Day(25, 10, 2004), time(7, 41));
    series.add(new Day(26, 10, 2004), time(7, 42));
    series.add(new Day(27, 10, 2004), time(7, 44));
    series.add(new Day(28, 10, 2004), time(7, 46));
    series.add(new Day(29, 10, 2004), time(7, 48));
    series.add(new Day(30, 10, 2004), time(7, 49));
    series.add(new Day(31, 10, 2004), time(6, 51));

    series.add(new Day(1, 11, 2004), time(6, 53));
    series.add(new Day(2, 11, 2004), time(6, 55));
    series.add(new Day(3, 11, 2004), time(6, 57));
    series.add(new Day(4, 11, 2004), time(6, 58));
    series.add(new Day(5, 11, 2004), time(7, 0));
    series.add(new Day(6, 11, 2004), time(7, 2));
    series.add(new Day(7, 11, 2004), time(7, 4));
    series.add(new Day(8, 11, 2004), time(7, 5));
    series.add(new Day(9, 11, 2004), time(7, 7));
    series.add(new Day(10, 11, 2004), time(7, 9));
    series.add(new Day(11, 11, 2004), time(7, 11));
    series.add(new Day(12, 11, 2004), time(7, 12));
    series.add(new Day(13, 11, 2004), time(7, 14));
    series.add(new Day(14, 11, 2004), time(7, 16));
    series.add(new Day(15, 11, 2004), time(7, 17));
    series.add(new Day(16, 11, 2004), time(7, 19));
    series.add(new Day(17, 11, 2004), time(7, 21));
    series.add(new Day(18, 11, 2004), time(7, 23));
    series.add(new Day(19, 11, 2004), time(7, 24));
    series.add(new Day(20, 11, 2004), time(7, 26));
    series.add(new Day(21, 11, 2004), time(7, 28));
    series.add(new Day(22, 11, 2004), time(7, 29));
    series.add(new Day(23, 11, 2004), time(7, 31));
    series.add(new Day(24, 11, 2004), time(7, 32));
    series.add(new Day(25, 11, 2004), time(7, 34));
    series.add(new Day(26, 11, 2004), time(7, 35));
    series.add(new Day(27, 11, 2004), time(7, 37));
    series.add(new Day(28, 11, 2004), time(7, 38));
    series.add(new Day(29, 11, 2004), time(7, 40));
    series.add(new Day(30, 11, 2004), time(7, 41));

    series.add(new Day(1, 12, 2004), time(7, 43));
    series.add(new Day(2, 12, 2004), time(7, 44));
    series.add(new Day(3, 12, 2004), time(7, 45));
    series.add(new Day(4, 12, 2004), time(7, 47));
    series.add(new Day(5, 12, 2004), time(7, 48));
    series.add(new Day(6, 12, 2004), time(7, 49));
    series.add(new Day(7, 12, 2004), time(7, 51));
    series.add(new Day(8, 12, 2004), time(7, 52));
    series.add(new Day(9, 12, 2004), time(7, 53));
    series.add(new Day(10, 12, 2004), time(7, 54));
    series.add(new Day(11, 12, 2004), time(7, 55));
    series.add(new Day(12, 12, 2004), time(7, 56));
    series.add(new Day(13, 12, 2004), time(7, 57));
    series.add(new Day(14, 12, 2004), time(7, 58));
    series.add(new Day(15, 12, 2004), time(7, 59));
    series.add(new Day(16, 12, 2004), time(7, 59));
    series.add(new Day(17, 12, 2004), time(8, 0));
    series.add(new Day(18, 12, 2004), time(8, 1));
    series.add(new Day(19, 12, 2004), time(8, 2));
    series.add(new Day(20, 12, 2004), time(8, 2));
    series.add(new Day(21, 12, 2004), time(8, 3));
    series.add(new Day(22, 12, 2004), time(8, 3));
    series.add(new Day(23, 12, 2004), time(8, 4));
    series.add(new Day(24, 12, 2004), time(8, 4));
    series.add(new Day(25, 12, 2004), time(8, 4));
    series.add(new Day(26, 12, 2004), time(8, 5));
    series.add(new Day(27, 12, 2004), time(8, 5));
    series.add(new Day(28, 12, 2004), time(8, 5));
    series.add(new Day(29, 12, 2004), time(8, 5));
    series.add(new Day(30, 12, 2004), time(8, 5));
    series.add(new Day(31, 12, 2004), time(8, 5));

    return series;
}

From source file:org.jfree.data.time.TimeSeriesTest.java

/**
 * Some simple checks for the hashCode() method.
 *///from w w w .ja  va2 s  . c o m
@Test
public void testHashCode() {
    TimeSeries s1 = new TimeSeries("Test");
    TimeSeries s2 = new TimeSeries("Test");
    assertEquals(s1, s2);
    assertEquals(s1.hashCode(), s2.hashCode());

    s1.add(new Day(1, 1, 2007), 500.0);
    s2.add(new Day(1, 1, 2007), 500.0);
    assertEquals(s1, s2);
    assertEquals(s1.hashCode(), s2.hashCode());

    s1.add(new Day(2, 1, 2007), null);
    s2.add(new Day(2, 1, 2007), null);
    assertEquals(s1, s2);
    assertEquals(s1.hashCode(), s2.hashCode());

    s1.add(new Day(5, 1, 2007), 111.0);
    s2.add(new Day(5, 1, 2007), 111.0);
    assertEquals(s1, s2);
    assertEquals(s1.hashCode(), s2.hashCode());

    s1.add(new Day(9, 1, 2007), 1.0);
    s2.add(new Day(9, 1, 2007), 1.0);
    assertEquals(s1, s2);
    assertEquals(s1.hashCode(), s2.hashCode());
}

From source file:ca.myewb.frame.servlet.GraphServlet.java

private JFreeChart getListMemberships(Session s, int groupId, UserModel currentUser) {
    final int NUM_MONTHS = 6;
    Logger log = Logger.getLogger(this.getClass());
    JFreeChart chart;//w  ww.  j  a  v  a 2s  .  c o  m
    Date startDate;
    TreeMap<Day, Integer> memberChange = new TreeMap<Day, Integer>();
    GroupModel g = (GroupModel) s.get(GroupModel.class, groupId);

    if (g == null) {
        log.warn("Someone requested chapter stats with a bad group id");
    } else if (!Permissions.canAdministerGroupMembership(currentUser, g)) {
        log.warn(currentUser.getUsername() + "tried to access list memberships graph!");
    }

    Calendar cal = GregorianCalendar.getInstance();
    Date now = cal.getTime();
    cal.set(Calendar.HOUR, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 1);
    cal.add(Calendar.MONTH, -NUM_MONTHS);
    startDate = cal.getTime();

    //Set Initial Number of Members      
    int initMembers = g.getNumMembers() + g.getNumRecipients();

    //Pull a list of all of the membership start dates
    List starts = s.createQuery("SELECT rm.start, count(*) " + "FROM RoleModel as rm "
            + "WHERE rm.group = :group " + "AND (rm.level = 'r' OR rm.level = 'm') "
            + "AND rm.start > :startDate " + "GROUP BY rm.start ").setEntity("group", g)
            .setDate("startDate", startDate).list();

    for (Object o : starts) {
        Day date = new Day((Date) (((Object[]) o)[0]));
        int change = ((Long) (((Object[]) o)[1])).intValue();
        memberChange.put(date, change);
        initMembers -= change;
    }

    //Pull a list of all of the membership end dates
    List ends = s.createQuery("SELECT rm.end, count(*) " + "FROM RoleModel as rm " + "WHERE rm.group = :group "
            + "AND (rm.level = 'r' OR rm.level = 'm') " + "AND rm.end > :startDate " + "GROUP BY rm.end ")
            .setEntity("group", g).setDate("startDate", startDate).list();

    for (Object o : ends) {
        Day date = new Day((Date) (((Object[]) o)[0]));
        int change = ((Long) (((Object[]) o)[1])).intValue();
        if (memberChange.containsKey(date)) {
            memberChange.put(date, memberChange.get(date) - change);
        } else {
            memberChange.put(date, -change);
        }
        initMembers += change;
    }

    TimeSeriesCollection theData = new TimeSeriesCollection();

    TimeSeries signups = new TimeSeries("List Membership", Day.class);
    theData.addSeries(signups);
    while (startDate.before(now)) {
        Day d = new Day(startDate);
        if (memberChange.containsKey(d)) {
            initMembers += memberChange.get(d);
        }
        signups.add(d, initMembers);
        cal.add(Calendar.DATE, 1);
        startDate = cal.getTime();
    }

    chart = ChartFactory.createTimeSeriesChart("List Members", "Day", "Number of Members", theData, true, true,
            true);

    XYPlot plot = (XYPlot) chart.getPlot();

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setSeriesStroke(0, new BasicStroke(2.0f));
    return chart;
}

From source file:org.jfree.data.time.TimeSeriesTest.java

/**
 * A test for bug 1832432.// w w w.  j  av a 2 s . com
 */
@Test
public void testBug1832432() throws CloneNotSupportedException {
    TimeSeries s1 = new TimeSeries("Series");
    TimeSeries s2 = (TimeSeries) s1.clone();
    assertTrue(s1 != s2);
    assertTrue(s1.getClass() == s2.getClass());
    assertTrue(s1.equals(s2));

    // test independence
    s1.add(new Day(1, 1, 2007), 100.0);
    assertFalse(s1.equals(s2));
}

From source file:org.jfree.data.time.junit.TimeSeriesTest.java

/**
 * Some checks for the getDataItem(int) method.
 *//*  ww  w  .  j  a va 2 s  . com*/
public void testGetDataItem1() {
    TimeSeries series = new TimeSeries("S");

    // can't get anything yet...just an exception
    boolean pass = false;
    try {
        /*TimeSeriesDataItem item =*/ series.getDataItem(0);
    } catch (IndexOutOfBoundsException e) {
        pass = true;
    }
    assertTrue(pass);

    series.add(new Year(2006), 100.0);
    TimeSeriesDataItem item = series.getDataItem(0);
    assertEquals(new Year(2006), item.getPeriod());
    pass = false;
    try {
        /*item = */series.getDataItem(-1);
    } catch (IndexOutOfBoundsException e) {
        pass = true;
    }
    assertTrue(pass);

    pass = false;
    try {
        /*item = */series.getDataItem(1);
    } catch (IndexOutOfBoundsException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:jgnash.ui.report.compiled.MonthlyAccountBalanceChartCompare.java

private TimeSeriesCollection createTimeSeriesCollection(final Account account, final Account a2) {
    //always use this method
    //if (subAccountCheckBox.isApproved()) {
    // Getting the dates to calculate
    LocalDate start = startDateField.getLocalDate().with(TemporalAdjusters.firstDayOfMonth());
    LocalDate stop = endDateField.getLocalDate().with(TemporalAdjusters.lastDayOfMonth());

    List<LocalDate> list = DateUtils.getLastDayOfTheMonths(start, stop);

    TimeSeries t = new TimeSeries(rb.getString("Column.Month"), rb.getString("Column.Month"),
            rb.getString("Column.Balance"));
    TimeSeries t2 = new TimeSeries(rb.getString("Column.Month"), rb.getString("Column.Month"),
            rb.getString("Column.Balance"));

    // For every month, calculate the total amount
    for (final LocalDate localDate : list) {
        final LocalDate d = localDate.with(TemporalAdjusters.lastDayOfMonth());
        final LocalDate s = localDate.with(TemporalAdjusters.firstDayOfMonth());

        // Get the total amount for the account and every sub accounts
        // for the specified date
        //BigDecimal bd_TotalAmount = calculateTotal(s, d, account, account.getCurrencyNode());
        BigDecimal bd_TotalAmount = calculateTotal(s, d, account, subAccountCheckBox.isSelected(),
                account.getCurrencyNode());

        // Include it in the graph
        t.add(new Month(DateUtils.asDate(localDate)), totalModulus(bd_TotalAmount, account.getAccountType()));
        if (jcb_compare.isSelected()) {
            bd_TotalAmount = calculateTotal(s, d, a2, subAccountCheckBox.isSelected(),
                    account.getCurrencyNode());
            t2.add(new Month(DateUtils.asDate(localDate)), totalModulus(bd_TotalAmount, a2.getAccountType()));
        }/*from   w  w  w.  ja  v a 2 s  . c o m*/
    }

    TimeSeriesCollection tsc = new TimeSeriesCollection();
    tsc.addSeries(t);
    if (jcb_compare.isSelected()) {
        tsc.addSeries(t2);
    }

    return tsc;
    /*
        return new TimeSeriesCollection(t);
    }
            
    int count = account.getTransactionCount();
            
    if (count > 0) {
        Date start = account.getTransactionAt(0).getDate();
        Date stop = account.getTransactionAt(count - 1).getDate();
        list = DateUtils.getLastDayOfTheMonths(start, stop);
    }
            
    TimeSeries t = new TimeSeries(rb.getString("Column.Month"), rb.getString("Column.Month"), rb.getString("Column.Balance"));
            
    AccountType type = account.getAccountType();
            
    for (Date aList : list) {
        // get balance for the whole month
        Date d = DateUtils.getLastDayOfTheMonth(aList);
        Date s = DateUtils.getFirstDayOfTheMonth(aList);
            
        BigDecimal balance = AccountBalanceDisplayManager.convertToSelectedBalanceMode(type, account.getBalance(s, d));
        t.add(new Month(aList), balance);
    }
            
    return new TimeSeriesCollection(t);
    */
}

From source file:se.technipelago.weather.chart.Generator.java

private XYDataset createHistoryDataset(final Date begin, final Date end, final String column,
        final String label) throws SQLException {
    final TimeSeriesCollection dataset = new TimeSeriesCollection();
    PreparedStatement stmt = null;
    ResultSet result = null;/* w  w w. j  a  va  2 s .  c o m*/
    long spanDays = (end.getTime() - begin.getTime()) / 1000 / 60 / 60 / 24;
    try {
        final java.sql.Timestamp sqlBegin = new java.sql.Timestamp(begin.getTime());
        final java.sql.Timestamp sqlEnd = new java.sql.Timestamp(end.getTime());
        if (spanDays < 100) {
            stmt = conn.prepareStatement("SELECT ts, " + column + " FROM archive WHERE " + column
                    + " IS NOT NULL AND ts BETWEEN ? AND ? ORDER BY ts");
        } else if (spanDays < 1000) {
            stmt = conn.prepareStatement("SELECT date_format(ts, '%Y-%m-%d %H:00:00') AS day, AVG(" + column
                    + ") AS value FROM archive WHERE " + column
                    + " IS NOT NULL AND ts BETWEEN ? AND ? GROUP BY 1");
        } else {
            stmt = conn.prepareStatement("SELECT date_format(ts, '%Y-%m-%d') AS day, AVG(" + column
                    + ") AS value FROM archive WHERE " + column
                    + " IS NOT NULL AND ts BETWEEN ? AND ? GROUP BY 1");
        }
        stmt.setTimestamp(1, sqlBegin);
        stmt.setTimestamp(2, sqlEnd);
        result = stmt.executeQuery();

        final TimeSeries s1 = new TimeSeries(label, FixedMillisecond.class);
        while (result.next()) {
            final java.sql.Timestamp ts = result.getTimestamp(1);
            final long timestamp = ts.getTime();
            s1.add(new FixedMillisecond(timestamp), result.getFloat(2));
        }
        dataset.addSeries(s1);
    } finally {
        if (result != null) {
            try {
                result.close();
            } catch (SQLException e) {
                log.log(Level.SEVERE, "Failed to close ResultSet", e);
            }
        }
        if (stmt != null) {
            try {
                stmt.close();
            } catch (SQLException ex) {
                log.log(Level.WARNING, "Failed to close select statement", ex);
            }
        }
    }

    return dataset;
}

From source file:ca.myewb.frame.servlet.GraphServlet.java

private JFreeChart getDailyStats(Session s) {
    JFreeChart chart;//from www .j a v a2 s.c om
    List<DailyStatsModel> stats = (new SafeHibList<DailyStatsModel>(
            s.createQuery("select ds from DailyStatsModel as ds where day<? and day>=? order by day desc")
                    .setDate(0, new Date()).setDate(1, GraphServlet.getStartDate()))).list();
    TimeSeriesCollection theData = new TimeSeriesCollection();

    TimeSeries signins = new TimeSeries("Raw Signins", Day.class);
    TimeSeries posts = new TimeSeries("Posts", Day.class);
    TimeSeries replies = new TimeSeries("Replies", Day.class);
    TimeSeries whiteboards = new TimeSeries("Whiteboards", Day.class);
    TimeSeries files = new TimeSeries("Files", Day.class);

    for (DailyStatsModel ds : stats) {
        Day theDay = new Day(ds.getDay());
        signins.add(theDay, ds.getSignins());
        posts.add(theDay, ds.getPosts());
        replies.add(theDay, ds.getReplies());
        whiteboards.add(theDay, ds.getWhiteboardEdits());
        files.add(theDay, ds.getFilesadded());
    }

    String title = "Usage (14-day moving avg)";
    theData.addSeries(MovingAverage.createMovingAverage(signins, "Signins", 14, 0));
    theData.addSeries(MovingAverage.createMovingAverage(posts, "Posts", 14, 0));
    theData.addSeries(MovingAverage.createMovingAverage(replies, "Replies", 14, 0));
    theData.addSeries(signins);
    theData.addSeries(MovingAverage.createMovingAverage(whiteboards, "Whiteboard Edits", 14, 0));
    theData.addSeries(MovingAverage.createMovingAverage(files, "Files Uploaded", 14, 0));

    chart = ChartFactory.createTimeSeriesChart(title, "Day", "Occurrences", theData, true, true, true);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.getRangeAxis().setUpperBound(400);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setSeriesStroke(0, new BasicStroke(2.0f));
    renderer.setSeriesStroke(1, new BasicStroke(2.0f));
    renderer.setSeriesStroke(2, new BasicStroke(2.0f));
    renderer.setSeriesStroke(3, new BasicStroke(2.0f));
    renderer.setSeriesStroke(4, new BasicStroke(2.0f));
    renderer.setSeriesStroke(5, new BasicStroke(2.0f));
    return chart;
}

From source file:org.jfree.data.time.junit.TimeSeriesTest.java

/**
 * A test for bug 1832432./* ww w  . j ava 2s .c  om*/
 */
public void testBug1832432() {
    TimeSeries s1 = new TimeSeries("Series");
    TimeSeries s2 = null;
    try {
        s2 = (TimeSeries) s1.clone();
    } catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(s1 != s2);
    assertTrue(s1.getClass() == s2.getClass());
    assertTrue(s1.equals(s2));

    // test independence
    s1.add(new Day(1, 1, 2007), 100.0);
    assertFalse(s1.equals(s2));
}