Example usage for org.jfree.data.time Day getEnd

List of usage examples for org.jfree.data.time Day getEnd

Introduction

In this page you can find the example usage for org.jfree.data.time Day getEnd.

Prototype

@Override
public Date getEnd() 

Source Link

Document

Returns the date/time that marks the end of the time period.

Usage

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

/**
 * Creates a dataset, consisting of two series of monthly data.
 *
 * @return the dataset./*from   ww w . ja v  a 2  s .co  m*/
 */
public XYDataset createDataset() {

    final TimePeriodValues s1 = new TimePeriodValues("Series 1");
    final Day d1 = new Day();
    final Day d2 = (Day) d1.next();
    final Day d3 = (Day) d2.next();
    final Day d4 = (Day) d3.next();
    final Day d5 = (Day) d4.next();
    final Day d6 = (Day) d5.next();
    final Day d7 = (Day) d6.next();

    s1.add(new SimpleTimePeriod(d6.getStart(), d6.getEnd()), 74.95);
    s1.add(new SimpleTimePeriod(d1.getStart(), d2.getEnd()), 55.75);
    s1.add(new SimpleTimePeriod(d7.getStart(), d7.getEnd()), 90.45);
    s1.add(new SimpleTimePeriod(d3.getStart(), d5.getEnd()), 105.75);

    final TimePeriodValuesCollection dataset = new TimePeriodValuesCollection();
    dataset.addSeries(s1);
    dataset.setDomainIsPointsInTime(false);

    return dataset;

}

From source file:de.forsthaus.backend.dao.impl.SecLoginlogDAOImpl.java

@Override
public ListLongSumBean<DummyBean> getDailyCountByCountries(Date aDate) {
    /**//w  w w  .  j  a  v  a2 s .c om
     * we set the dateFrom time manually to hh/mm/ss = 00:00:01 and the
     * dateTo time manually to date + hh/mm/SS = 23:59:59.<br>
     */
    Day day = new Day(aDate);
    Date dateFrom = day.getStart();
    Date dateTo = day.getEnd();

    String str1 = " SELECT DISTINCT (countrycode.ccdCode2), countrycode.ccdName, count(*) as count ";
    String str2 = " FROM Ip2Country AS log_ip2country, CountryCode AS countrycode ";
    String str3 = " , SecLoginlog as secLoginLog ";
    String str4 = " WHERE secLoginLog.ip2Country = log_ip2country.id ";
    String str5 = " AND log_ip2country.countryCode = countrycode.id ";
    String str6 = " AND secLoginLog.lglLogtime BETWEEN ? AND ? ";
    String str7 = " GROUP BY countrycode.ccdCode2, countrycode.ccdName ORDER BY count(*) desc ";
    String hqlStr = str1 + str2 + str3 + str4 + str5 + str6 + str7;

    Object[] params = { dateFrom, dateTo };

    return new ListLongSumBean<DummyBean>(
            CustomDataAccessUtils.transfer2Bean(getHibernateTemplate().find(hqlStr, params), DummyBean.class,
                    "country", "countryName", "totalCount"));
}

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

/**
 * Some checks for the getEnd() method.//from w  w w .  j  a v  a 2  s.com
 */
@Test
public void testGetEnd() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(1900, Calendar.JANUARY, 1, 23, 59, 59);
    cal.set(Calendar.MILLISECOND, 999);
    Day d = new Day(1, 1, 1900);
    assertEquals(cal.getTime(), d.getEnd());
    Locale.setDefault(saved);
}

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

/**
 * Some checks for the getEnd() method./*w  w w.j av a  2  s  .  com*/
 */
public void testGetEnd() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(1900, Calendar.JANUARY, 1, 23, 59, 59);
    cal.set(Calendar.MILLISECOND, 999);
    Day d = new Day(1, 1, 1900);
    assertEquals(cal.getTime(), d.getEnd());
    Locale.setDefault(saved);
}

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

/**
 * A demonstration application showing how to...
 *
 * @param title  the frame title./*from   w ww.  j  av  a  2 s. com*/
 */
public TimeSeriesDemo11(final String title) {

    super(title);
    final JPanel panel = new JPanel(new GridLayout(2, 2));
    panel.setPreferredSize(new java.awt.Dimension(800, 600));

    final Day today = new Day();
    final XYDataset dataset = createDataset("Series 1", 100.0, today, 365);

    final JFreeChart chart1 = createChart("Chart 1 : 1 Year", dataset);
    final ChartPanel chartPanel1 = new ChartPanel(chart1);
    panel.add(chartPanel1);

    final JFreeChart chart2 = createChart("Chart 2 : 6 Months", dataset);
    final SerialDate t = today.getSerialDate();
    final SerialDate t6m = SerialDate.addMonths(-6, t);
    final Day sixMonthsAgo = new Day(t6m);
    final DateAxis axis2 = (DateAxis) chart2.getXYPlot().getDomainAxis();
    axis2.setRange(sixMonthsAgo.getStart(), today.getEnd());
    final ChartPanel chartPanel2 = new ChartPanel(chart2);
    panel.add(chartPanel2);

    final JFreeChart chart3 = createChart("Chart 3 : 3 Months", dataset);
    final SerialDate t3m = SerialDate.addMonths(-3, t);
    final Day threeMonthsAgo = new Day(t3m);
    final DateAxis axis3 = (DateAxis) chart3.getXYPlot().getDomainAxis();
    axis3.setRange(threeMonthsAgo.getStart(), today.getEnd());
    final ChartPanel chartPanel3 = new ChartPanel(chart3);
    panel.add(chartPanel3);

    final JFreeChart chart4 = createChart("Chart 4 : 1 Month", dataset);
    final SerialDate t1m = SerialDate.addMonths(-1, t);
    final Day oneMonthsAgo = new Day(t1m);
    final DateAxis axis4 = (DateAxis) chart4.getXYPlot().getDomainAxis();
    axis4.setRange(oneMonthsAgo.getStart(), today.getEnd());
    final ChartPanel chartPanel4 = new ChartPanel(chart4);
    panel.add(chartPanel4);

    setContentPane(panel);

}