Java 类org.jfree.data.time.Day 实例源码

项目:iveely.ml    文件:ChartUtils.java   
public static TimeSeries createTimeseries(String category, Vector<Object[]> dateValues) {
    TimeSeries timeseries = new TimeSeries(category);

    if (dateValues != null) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        for (Object[] objects : dateValues) {
            Date date = null;
            try {
                date = dateFormat.parse(objects[0].toString());
            } catch (ParseException e) {
            }
            String sValue = objects[1].toString();
            double dValue = 0;
            if (date != null && isNumber(sValue)) {
                dValue = Double.parseDouble(sValue);
                timeseries.add(new Day(date), dValue);
            }
        }
    }

    return timeseries;
}
项目:parabuild-ci    文件:XYPlotTests.java   
/**
 * Creates a sample dataset.
 *
 * @return Series 1.
 */
private IntervalXYDataset createDataset1() {

    // create dataset 1...
    TimeSeries series1 = new TimeSeries("Series 1", Day.class);
    series1.add(new Day(1, MonthConstants.MARCH, 2002), 12353.3);
    series1.add(new Day(2, MonthConstants.MARCH, 2002), 13734.4);
    series1.add(new Day(3, MonthConstants.MARCH, 2002), 14525.3);
    series1.add(new Day(4, MonthConstants.MARCH, 2002), 13984.3);
    series1.add(new Day(5, MonthConstants.MARCH, 2002), 12999.4);
    series1.add(new Day(6, MonthConstants.MARCH, 2002), 14274.3);
    series1.add(new Day(7, MonthConstants.MARCH, 2002), 15943.5);
    series1.add(new Day(8, MonthConstants.MARCH, 2002), 14845.3);
    series1.add(new Day(9, MonthConstants.MARCH, 2002), 14645.4);
    series1.add(new Day(10, MonthConstants.MARCH, 2002), 16234.6);
    series1.add(new Day(11, MonthConstants.MARCH, 2002), 17232.3);
    series1.add(new Day(12, MonthConstants.MARCH, 2002), 14232.2);
    series1.add(new Day(13, MonthConstants.MARCH, 2002), 13102.2);
    series1.add(new Day(14, MonthConstants.MARCH, 2002), 14230.2);
    series1.add(new Day(15, MonthConstants.MARCH, 2002), 11235.2);

    TimeSeriesCollection collection = new TimeSeriesCollection(series1);
    return collection;

}
项目:ccu-historian    文件:XYPlotTest.java   
/**
 * Creates a sample dataset.
 *
 * @return Series 1.
 */
private IntervalXYDataset createDataset1() {

    // create dataset 1...
    TimeSeries series1 = new TimeSeries("Series 1", Day.class);
    series1.add(new Day(1, MonthConstants.MARCH, 2002), 12353.3);
    series1.add(new Day(2, MonthConstants.MARCH, 2002), 13734.4);
    series1.add(new Day(3, MonthConstants.MARCH, 2002), 14525.3);
    series1.add(new Day(4, MonthConstants.MARCH, 2002), 13984.3);
    series1.add(new Day(5, MonthConstants.MARCH, 2002), 12999.4);
    series1.add(new Day(6, MonthConstants.MARCH, 2002), 14274.3);
    series1.add(new Day(7, MonthConstants.MARCH, 2002), 15943.5);
    series1.add(new Day(8, MonthConstants.MARCH, 2002), 14845.3);
    series1.add(new Day(9, MonthConstants.MARCH, 2002), 14645.4);
    series1.add(new Day(10, MonthConstants.MARCH, 2002), 16234.6);
    series1.add(new Day(11, MonthConstants.MARCH, 2002), 17232.3);
    series1.add(new Day(12, MonthConstants.MARCH, 2002), 14232.2);
    series1.add(new Day(13, MonthConstants.MARCH, 2002), 13102.2);
    series1.add(new Day(14, MonthConstants.MARCH, 2002), 14230.2);
    series1.add(new Day(15, MonthConstants.MARCH, 2002), 11235.2);

    TimeSeriesCollection collection = new TimeSeriesCollection(series1);
    return collection;

}
项目:JGrafix    文件:Utils.java   
public static boolean mesmoMes(Day inicio, Day fim){
    int monthInicio  = inicio.getMonth();
    int monthFim  = fim.getMonth();
    int yearInicio  = inicio.getYear();
    int yearFim  = fim.getYear();

    boolean retorno = false;
    if(monthFim == monthInicio){
        retorno =  true;
    }

    if(retorno && yearInicio != yearFim){
        retorno =  false;
    }


    return retorno;

}
项目:open-java-trade-manager    文件:ChartLayerUI.java   
private int getDataIndex(TimeSeries timeSeries, Day targetDay) {
    int low = 0;
    int high = timeSeries.getItemCount() - 1;

    while (low <= high) {
        int mid = (low + high) >>> 1;

        final TimeSeriesDataItem timeSeriesDataItem = timeSeries.getDataItem(mid);
        final Day searchDay = (Day)timeSeriesDataItem.getPeriod();
        final long cmp = searchDay.compareTo(targetDay);

        if (cmp < 0) {
            low = mid + 1;
        }
        else if (cmp > 0) {
            high = mid - 1;
        }
        else {
            return mid;
        }
    }
    return -1;
}
项目:financehelper    文件:IndustryTimeSeriesChart.java   
private XYDataset createDataset(List<String> industrys) {
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    if (industrys != null) {
        for (String industry : industrys) {
            TimeSeries timeseries = new TimeSeries(industry + "资金统计",
                    org.jfree.data.time.Day.class);
            List<IndustryInfo> industryInfos = industryInfoDao.get(industry);
            Double value = 0.0;
            if (industryInfos != null) {
                for (IndustryInfo industryInfo : industryInfos) {
                    value = value + industryInfo.getTotal() / 10000;
                    timeseries.add(new Day(DateUtil.parse(String.valueOf(industryInfo.getDate()), DateUtil.DATE_FORMAT_DAY_SHORT)), value);
                }
            }
            timeseriescollection.addSeries(timeseries);
        }
    }
    return timeseriescollection;
}
项目:financehelper    文件:IndustryRiseChart.java   
private XYDataset createDataset(List<String> industrys) {
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    if (industrys != null) {
        for (String industry : industrys) {
            TimeSeries timeseries = new TimeSeries(industry + "涨跌统计",
                    org.jfree.data.time.Day.class);
            List<IndustryInfo> industryInfos = industryInfoDao.get(industry);
            BigDecimal value = new BigDecimal(0);
            if (industryInfos != null) {
                for (IndustryInfo industryInfo : industryInfos) {
                    if (industryInfo.getRise() != null) {
                        value = value.add(industryInfo.getRise());
                    }
                    timeseries.add(new Day(DateUtil.parse(String.valueOf(industryInfo.getDate()), DateUtil.DATE_FORMAT_DAY_SHORT)), value);
                }
            }
            timeseriescollection.addSeries(timeseries);
        }
    }
    return timeseriescollection;
}
项目:parabuild-ci    文件:TimePeriodValuesTests.java   
/**
 * Tests the equals method.
 */
public void testEquals() {
    final TimePeriodValues s1 = new TimePeriodValues("Time Series 1");
    final TimePeriodValues s2 = new TimePeriodValues("Time Series 2");
    final boolean b1 = s1.equals(s2);
    assertFalse("b1", b1);

    s2.setName("Time Series 1");
    final boolean b2 = s1.equals(s2);
    assertTrue("b2", b2);

    final RegularTimePeriod p1 = new Day();
    final RegularTimePeriod p2 = p1.next();
    s1.add(p1, 100.0);
    s1.add(p2, 200.0);
    final boolean b3 = s1.equals(s2);
    assertFalse("b3", b3);

    s2.add(p1, 100.0);
    s2.add(p2, 200.0);
    final boolean b4 = s1.equals(s2);
    assertTrue("b4", b4);

}
项目:parabuild-ci    文件:MovingAverageTests.java   
/**
 * Creates a sample series.
 * 
 * @return A sample series.
 */
private TimeSeries createDailyTimeSeries1() {

    final TimeSeries series = new TimeSeries("Series 1", Day.class);
    series.add(new Day(11, SerialDate.AUGUST, 2003), 11.2);
    series.add(new Day(13, SerialDate.AUGUST, 2003), 13.8);
    series.add(new Day(17, SerialDate.AUGUST, 2003), 14.1);
    series.add(new Day(18, SerialDate.AUGUST, 2003), 12.7);
    series.add(new Day(19, SerialDate.AUGUST, 2003), 16.5);
    series.add(new Day(20, SerialDate.AUGUST, 2003), 15.6);
    series.add(new Day(25, SerialDate.AUGUST, 2003), 19.8);
    series.add(new Day(27, SerialDate.AUGUST, 2003), 10.7);
    series.add(new Day(28, SerialDate.AUGUST, 2003), 14.3);
    return series;

}
项目:parabuild-ci    文件:MovingAverageTests.java   
/**
 * Creates a sample series.
 * 
 * @return A sample series.
 */
private TimeSeries createDailyTimeSeries1() {

    TimeSeries series = new TimeSeries("Series 1", Day.class);
    series.add(new Day(11, MonthConstants.AUGUST, 2003), 11.2);
    series.add(new Day(13, MonthConstants.AUGUST, 2003), 13.8);
    series.add(new Day(17, MonthConstants.AUGUST, 2003), 14.1);
    series.add(new Day(18, MonthConstants.AUGUST, 2003), 12.7);
    series.add(new Day(19, MonthConstants.AUGUST, 2003), 16.5);
    series.add(new Day(20, MonthConstants.AUGUST, 2003), 15.6);
    series.add(new Day(25, MonthConstants.AUGUST, 2003), 19.8);
    series.add(new Day(27, MonthConstants.AUGUST, 2003), 10.7);
    series.add(new Day(28, MonthConstants.AUGUST, 2003), 14.3);
    return series;

}
项目:parabuild-ci    文件:TimeSeriesDataItemTests.java   
/**
 * Test the equals() method.
 */
public void testEquals() {
    TimeSeriesDataItem item1 = new TimeSeriesDataItem(
        new Day(23, 9, 2001), 99.7
    );
    TimeSeriesDataItem item2 = new TimeSeriesDataItem(
        new Day(23, 9, 2001), 99.7
    );
    assertTrue(item1.equals(item2));
    assertTrue(item2.equals(item1));

    item1.setValue(new Integer(5));
    assertFalse(item1.equals(item2));
    item2.setValue(new Integer(5));
    assertTrue(item1.equals(item2));
}
项目:parabuild-ci    文件:DayTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Day d = new Day(26, 4, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-621187200000L, d.getFirstMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        d.getFirstMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
项目:parabuild-ci    文件:DayTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Day d = new Day(1, 12, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(1007164800000L, d.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        d.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:parabuild-ci    文件:DayTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithTimeZone() {
    Day d = new Day(1, 2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-628358400001L, d.getLastMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        d.getLastMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
项目:parabuild-ci    文件:DayTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithCalendar() {
    Day d = new Day(4, 5, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(989017199999L, d.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        d.getLastMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:parabuild-ci    文件:TimePeriodValuesCollectionTests.java   
/**
 * A test for bug report 1161340.  I wasn't able to reproduce the problem
 * with this test.
 */
public void test1161340() {
    TimePeriodValuesCollection dataset = new TimePeriodValuesCollection();
    TimePeriodValues v1 = new TimePeriodValues("V1");
    v1.add(new Day(11, 3, 2005), 1.2);
    v1.add(new Day(12, 3, 2005), 3.4);
    dataset.addSeries(v1);
    assertEquals(1, dataset.getSeriesCount());
    dataset.removeSeries(v1);
    assertEquals(0, dataset.getSeriesCount());

    TimePeriodValues v2 = new TimePeriodValues("V2");
    v1.add(new Day(5, 3, 2005), 1.2);
    v1.add(new Day(6, 3, 2005), 3.4);
    dataset.addSeries(v2);
    assertEquals(1, dataset.getSeriesCount());
}
项目:ccu-historian    文件:JFreeChartTest.java   
/**
 * Serialize a time seroes chart, restore it, and check for equality.
 */
@Test
public void testSerialization4() {

    RegularTimePeriod t = new Day();
    TimeSeries series = new TimeSeries("Series 1");
    series.add(t, 36.4);
    t = t.next();
    series.add(t, 63.5);
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series);

    JFreeChart c1 = ChartFactory.createTimeSeriesChart("Test", "Date",
            "Value", dataset);
    JFreeChart c2 = (JFreeChart) TestUtilities.serialised(c1);
    assertEquals(c1, c2);
}
项目:jfreechart    文件:JFreeChartTest.java   
/**
 * Serialize a time seroes chart, restore it, and check for equality.
 */
@Test
public void testSerialization4() {

    RegularTimePeriod t = new Day();
    TimeSeries series = new TimeSeries("Series 1");
    series.add(t, 36.4);
    t = t.next();
    series.add(t, 63.5);
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series);

    JFreeChart c1 = ChartFactory.createTimeSeriesChart("Test", "Date",
            "Value", dataset);
    JFreeChart c2 = (JFreeChart) TestUtils.serialised(c1);
    assertEquals(c1, c2);
}
项目:jfreechart    文件:XYPlotTest.java   
/**
 * Creates a sample dataset.
 *
 * @return Series 1.
 */
private IntervalXYDataset createDataset1() {

    // create dataset 1...
    TimeSeries series1 = new TimeSeries("Series 1");
    series1.add(new Day(1, MonthConstants.MARCH, 2002), 12353.3);
    series1.add(new Day(2, MonthConstants.MARCH, 2002), 13734.4);
    series1.add(new Day(3, MonthConstants.MARCH, 2002), 14525.3);
    series1.add(new Day(4, MonthConstants.MARCH, 2002), 13984.3);
    series1.add(new Day(5, MonthConstants.MARCH, 2002), 12999.4);
    series1.add(new Day(6, MonthConstants.MARCH, 2002), 14274.3);
    series1.add(new Day(7, MonthConstants.MARCH, 2002), 15943.5);
    series1.add(new Day(8, MonthConstants.MARCH, 2002), 14845.3);
    series1.add(new Day(9, MonthConstants.MARCH, 2002), 14645.4);
    series1.add(new Day(10, MonthConstants.MARCH, 2002), 16234.6);
    series1.add(new Day(11, MonthConstants.MARCH, 2002), 17232.3);
    series1.add(new Day(12, MonthConstants.MARCH, 2002), 14232.2);
    series1.add(new Day(13, MonthConstants.MARCH, 2002), 13102.2);
    series1.add(new Day(14, MonthConstants.MARCH, 2002), 14230.2);
    series1.add(new Day(15, MonthConstants.MARCH, 2002), 11235.2);

    TimeSeriesCollection collection = new TimeSeriesCollection(series1);
    return collection;

}
项目:aya-lang    文件:JFreeChartTest.java   
/**
 * Serialize a time seroes chart, restore it, and check for equality.
 */
@Test
public void testSerialization4() {

    RegularTimePeriod t = new Day();
    TimeSeries series = new TimeSeries("Series 1");
    series.add(t, 36.4);
    t = t.next();
    series.add(t, 63.5);
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series);

    JFreeChart c1 = ChartFactory.createTimeSeriesChart("Test", "Date",
            "Value", dataset);
    JFreeChart c2 = (JFreeChart) TestUtilities.serialised(c1);
    assertEquals(c1, c2);
}
项目:aya-lang    文件:XYPlotTest.java   
/**
 * Creates a sample dataset.
 *
 * @return Series 1.
 */
private IntervalXYDataset createDataset1() {

    // create dataset 1...
    TimeSeries series1 = new TimeSeries("Series 1", Day.class);
    series1.add(new Day(1, MonthConstants.MARCH, 2002), 12353.3);
    series1.add(new Day(2, MonthConstants.MARCH, 2002), 13734.4);
    series1.add(new Day(3, MonthConstants.MARCH, 2002), 14525.3);
    series1.add(new Day(4, MonthConstants.MARCH, 2002), 13984.3);
    series1.add(new Day(5, MonthConstants.MARCH, 2002), 12999.4);
    series1.add(new Day(6, MonthConstants.MARCH, 2002), 14274.3);
    series1.add(new Day(7, MonthConstants.MARCH, 2002), 15943.5);
    series1.add(new Day(8, MonthConstants.MARCH, 2002), 14845.3);
    series1.add(new Day(9, MonthConstants.MARCH, 2002), 14645.4);
    series1.add(new Day(10, MonthConstants.MARCH, 2002), 16234.6);
    series1.add(new Day(11, MonthConstants.MARCH, 2002), 17232.3);
    series1.add(new Day(12, MonthConstants.MARCH, 2002), 14232.2);
    series1.add(new Day(13, MonthConstants.MARCH, 2002), 13102.2);
    series1.add(new Day(14, MonthConstants.MARCH, 2002), 14230.2);
    series1.add(new Day(15, MonthConstants.MARCH, 2002), 11235.2);

    TimeSeriesCollection collection = new TimeSeriesCollection(series1);
    return collection;

}
项目:JGrafix    文件:BoletimBovespa.java   
private double retornaLiquidez(String papel, int npregoes) {
    double liquidez = 0.0;
    Cotacoes cotacao = new Cotacoes(Controle.getConfiguracoesGrafix().getPathBaseDados(), 1);
    // retorna os ultimos pregosMostrados do arquivo Pregoes.dat

    String datas = Cotacoes.tail(cotacao.getDiretorioCotacoes() + "cfg/datasjarealizadas", npregoes);
    datas = datas.replaceAll("\r\n", "\n");
    datas = datas.replaceAll("\r", "\n");

    String[] ultimosPregoes = datas.split("\n");

    // retorna as ultimas cotacoes do papel

    String[] ultimasCotacoes = cotacao.ultimasCotacoes(papel, npregoes);
    Day primeiroDia = Cotacoes.converterEmData(ultimosPregoes[0]);

    for (int i = 0; i < ultimasCotacoes.length; ++i) {
        String data = ultimasCotacoes[i].substring(0, 10);
        if (primeiroDia.compareTo(Cotacoes.converterEmData(data)) <= 0) {
            liquidez += 1;
        }
    }
    return 100.0 * liquidez / (double) npregoes;

}
项目:JGrafix    文件:Cotacoes.java   
public RegistroDiario decodificaLinhaYahoo(String linha) {
    RegistroDiario reg = null;
    if ((linha != null) && linha.length() > 0) {
        String[] campos = linha.split(",");
        int dia = new Integer(campos[0].substring(8, 10)).intValue();
        int mes = new Integer(campos[0].substring(5, 7)).intValue();
        int ano = new Integer(campos[0].substring(0, 4)).intValue();
        reg = new RegistroDiario(new Day(dia, mes, ano));
        reg.setOpen(new Double(campos[1]).doubleValue());
        reg.setHigh(new Double(campos[2]).doubleValue());
        reg.setLow(new Double(campos[3]).doubleValue());
        reg.setClose(new Double(campos[4]).doubleValue());
        reg.setVolumeDinheiro(new Double(campos[5]).doubleValue());
        reg.setVolumeQuant(reg.getVolumeDinheiro());
        reg.setNumNegocios(0.0);
    }
    return reg;
}
项目:JGrafix    文件:MarcaGrafica.java   
private Day getDataNoGrafico(Day data, JanelaGraficos janela, boolean antes) {
    Acao acao = janela.getAcao();
    for (int i = 0; i < acao.getNumeroRegistros(); i++) {
        RegistroDiario r = acao.getRegistro(i);
        if(antes) {
            if(r.getData().compareTo(data) >=0) {
                return r.getData(Controle.getConfiguracoesUsuario().isExibeSomenteDiasUteis());
            }
        } else {
            if(r.getData().compareTo(data) > 0) {
                return r.getData(Controle.getConfiguracoesUsuario().isExibeSomenteDiasUteis());
            }
        }
    }
    System.err.println("[ERRO] Erro na conversao de data da marca!");
    return null;
}
项目:JGrafix    文件:TelaComparativos.java   
private Vector<IndiceComparativo> gerarIndices() {
    Vector<IndiceComparativo> resultado = new Vector<IndiceComparativo>();
    Day dataComparacao = Day.parseDay(comboData.getSelectedItem().toString());
    resultado.add(new IndiceComparativo(Controle.getCarteira().getAcao(combo1.getSelectedItem().toString()), dataComparacao));
    if(cb2.isSelected()) {
        resultado.add(new IndiceComparativo(Controle.getCarteira().getAcao(combo2.getSelectedItem().toString()), dataComparacao));
    }
    if(cb3.isSelected()) {
        resultado.add(new IndiceComparativo(Controle.getCarteira().getAcao(combo3.getSelectedItem().toString()), dataComparacao));
    }
    if(cb4.isSelected()) {
        resultado.add(new IndiceComparativo(Controle.getCarteira().getAcao(combo4.getSelectedItem().toString()), dataComparacao));
    }
    if(cb5.isSelected()) {
        resultado.add(new IndiceComparativo(Controle.getCarteira().getAcao(combo5.getSelectedItem().toString()), dataComparacao));
    }
    return resultado;
}
项目:AnSoMia    文件:MarketValueChart.java   
/**
 * Creates the dataset.
 *
 * @return the XY dataset
 */
private XYDataset createDataset() {

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    TimeSeries s1 = new TimeSeries(this.values1_des);

    for(int i = 0; i < this.values1.length; i++) {
        s1.add(new Day(dates.get(i)), this.values1[i]);
    }
    dataset.addSeries(s1);

    if(this.values2 != null) {
     TimeSeries s2 = new TimeSeries(this.values2_des);

     for(int i = 0; i < this.values2.length; i++) {
        s2.add(new Day(dates.get(i)), this.values2[i]);
     }

     dataset.addSeries(s2);
    }

    return dataset;

}
项目:nabs    文件:XYPlotTests.java   
/**
 * Creates a sample dataset.
 *
 * @return Series 1.
 */
private IntervalXYDataset createDataset1() {

    // create dataset 1...
    TimeSeries series1 = new TimeSeries("Series 1", Day.class);
    series1.add(new Day(1, MonthConstants.MARCH, 2002), 12353.3);
    series1.add(new Day(2, MonthConstants.MARCH, 2002), 13734.4);
    series1.add(new Day(3, MonthConstants.MARCH, 2002), 14525.3);
    series1.add(new Day(4, MonthConstants.MARCH, 2002), 13984.3);
    series1.add(new Day(5, MonthConstants.MARCH, 2002), 12999.4);
    series1.add(new Day(6, MonthConstants.MARCH, 2002), 14274.3);
    series1.add(new Day(7, MonthConstants.MARCH, 2002), 15943.5);
    series1.add(new Day(8, MonthConstants.MARCH, 2002), 14845.3);
    series1.add(new Day(9, MonthConstants.MARCH, 2002), 14645.4);
    series1.add(new Day(10, MonthConstants.MARCH, 2002), 16234.6);
    series1.add(new Day(11, MonthConstants.MARCH, 2002), 17232.3);
    series1.add(new Day(12, MonthConstants.MARCH, 2002), 14232.2);
    series1.add(new Day(13, MonthConstants.MARCH, 2002), 13102.2);
    series1.add(new Day(14, MonthConstants.MARCH, 2002), 14230.2);
    series1.add(new Day(15, MonthConstants.MARCH, 2002), 11235.2);

    TimeSeriesCollection collection = new TimeSeriesCollection(series1);
    return collection;

}
项目:astor    文件:TimePeriodValuesCollectionTests.java   
/**
 * A test for bug report 1161340.  I wasn't able to reproduce the problem
 * with this test.
 */
public void test1161340() {
    TimePeriodValuesCollection dataset = new TimePeriodValuesCollection();
    TimePeriodValues v1 = new TimePeriodValues("V1");
    v1.add(new Day(11, 3, 2005), 1.2);
    v1.add(new Day(12, 3, 2005), 3.4);
    dataset.addSeries(v1);
    assertEquals(1, dataset.getSeriesCount());
    dataset.removeSeries(v1);
    assertEquals(0, dataset.getSeriesCount());

    TimePeriodValues v2 = new TimePeriodValues("V2");
    v1.add(new Day(5, 3, 2005), 1.2);
    v1.add(new Day(6, 3, 2005), 3.4);
    dataset.addSeries(v2);
    assertEquals(1, dataset.getSeriesCount());
}
项目:nabs    文件:MovingAverageTests.java   
/**
 * Creates a sample series.
 * 
 * @return A sample series.
 */
private TimeSeries createDailyTimeSeries1() {

    TimeSeries series = new TimeSeries("Series 1", Day.class);
    series.add(new Day(11, MonthConstants.AUGUST, 2003), 11.2);
    series.add(new Day(13, MonthConstants.AUGUST, 2003), 13.8);
    series.add(new Day(17, MonthConstants.AUGUST, 2003), 14.1);
    series.add(new Day(18, MonthConstants.AUGUST, 2003), 12.7);
    series.add(new Day(19, MonthConstants.AUGUST, 2003), 16.5);
    series.add(new Day(20, MonthConstants.AUGUST, 2003), 15.6);
    series.add(new Day(25, MonthConstants.AUGUST, 2003), 19.8);
    series.add(new Day(27, MonthConstants.AUGUST, 2003), 10.7);
    series.add(new Day(28, MonthConstants.AUGUST, 2003), 14.3);
    return series;

}
项目:nabs    文件:TimeSeriesDataItemTests.java   
/**
 * Test the equals() method.
 */
public void testEquals() {
    TimeSeriesDataItem item1 = new TimeSeriesDataItem(
        new Day(23, 9, 2001), 99.7
    );
    TimeSeriesDataItem item2 = new TimeSeriesDataItem(
        new Day(23, 9, 2001), 99.7
    );
    assertTrue(item1.equals(item2));
    assertTrue(item2.equals(item1));

    item1.setValue(new Integer(5));
    assertFalse(item1.equals(item2));
    item2.setValue(new Integer(5));
    assertTrue(item1.equals(item2));
}
项目:nabs    文件:DayTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithTimeZone() {
    Day d = new Day(26, 4, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-621187200000L, d.getFirstMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        d.getFirstMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
项目:nabs    文件:DayTests.java   
/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 */
public void testGetFirstMillisecondWithCalendar() {
    Day d = new Day(1, 12, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(1007164800000L, d.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        d.getFirstMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:nabs    文件:DayTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithTimeZone() {
    Day d = new Day(1, 2, 1950);
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    assertEquals(-628358400001L, d.getLastMillisecond(zone));

    // try null calendar
    boolean pass = false;
    try {
        d.getLastMillisecond((TimeZone) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);            
}
项目:nabs    文件:DayTests.java   
/**
 * Some checks for the getLastMillisecond(TimeZone) method.
 */
public void testGetLastMillisecondWithCalendar() {
    Day d = new Day(4, 5, 2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    assertEquals(989017199999L, d.getLastMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        d.getLastMillisecond((Calendar) null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}
项目:nabs    文件:TimePeriodValuesCollectionTests.java   
/**
 * A test for bug report 1161340.  I wasn't able to reproduce the problem
 * with this test.
 */
public void test1161340() {
    TimePeriodValuesCollection dataset = new TimePeriodValuesCollection();
    TimePeriodValues v1 = new TimePeriodValues("V1");
    v1.add(new Day(11, 3, 2005), 1.2);
    v1.add(new Day(12, 3, 2005), 3.4);
    dataset.addSeries(v1);
    assertEquals(1, dataset.getSeriesCount());
    dataset.removeSeries(v1);
    assertEquals(0, dataset.getSeriesCount());

    TimePeriodValues v2 = new TimePeriodValues("V2");
    v1.add(new Day(5, 3, 2005), 1.2);
    v1.add(new Day(6, 3, 2005), 3.4);
    dataset.addSeries(v2);
    assertEquals(1, dataset.getSeriesCount());
}
项目:ECG-Viewer    文件:JFreeChartTest.java   
/**
 * Serialize a time seroes chart, restore it, and check for equality.
 */
@Test
public void testSerialization4() {

    RegularTimePeriod t = new Day();
    TimeSeries series = new TimeSeries("Series 1");
    series.add(t, 36.4);
    t = t.next();
    series.add(t, 63.5);
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series);

    JFreeChart c1 = ChartFactory.createTimeSeriesChart("Test", "Date",
            "Value", dataset);
    JFreeChart c2 = (JFreeChart) TestUtilities.serialised(c1);
    assertEquals(c1, c2);
}
项目:ECG-Viewer    文件:XYPlotTest.java   
/**
 * Creates a sample dataset.
 *
 * @return Series 1.
 */
private IntervalXYDataset createDataset1() {

    // create dataset 1...
    TimeSeries series1 = new TimeSeries("Series 1", Day.class);
    series1.add(new Day(1, MonthConstants.MARCH, 2002), 12353.3);
    series1.add(new Day(2, MonthConstants.MARCH, 2002), 13734.4);
    series1.add(new Day(3, MonthConstants.MARCH, 2002), 14525.3);
    series1.add(new Day(4, MonthConstants.MARCH, 2002), 13984.3);
    series1.add(new Day(5, MonthConstants.MARCH, 2002), 12999.4);
    series1.add(new Day(6, MonthConstants.MARCH, 2002), 14274.3);
    series1.add(new Day(7, MonthConstants.MARCH, 2002), 15943.5);
    series1.add(new Day(8, MonthConstants.MARCH, 2002), 14845.3);
    series1.add(new Day(9, MonthConstants.MARCH, 2002), 14645.4);
    series1.add(new Day(10, MonthConstants.MARCH, 2002), 16234.6);
    series1.add(new Day(11, MonthConstants.MARCH, 2002), 17232.3);
    series1.add(new Day(12, MonthConstants.MARCH, 2002), 14232.2);
    series1.add(new Day(13, MonthConstants.MARCH, 2002), 13102.2);
    series1.add(new Day(14, MonthConstants.MARCH, 2002), 14230.2);
    series1.add(new Day(15, MonthConstants.MARCH, 2002), 11235.2);

    TimeSeriesCollection collection = new TimeSeriesCollection(series1);
    return collection;

}
项目:group-five    文件:JFreeChartTest.java   
/**
 * Serialize a time seroes chart, restore it, and check for equality.
 */
@Test
public void testSerialization4() {

    RegularTimePeriod t = new Day();
    TimeSeries series = new TimeSeries("Series 1");
    series.add(t, 36.4);
    t = t.next();
    series.add(t, 63.5);
    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series);

    JFreeChart c1 = ChartFactory.createTimeSeriesChart("Test", "Date",
            "Value", dataset);
    JFreeChart c2 = (JFreeChart) TestUtilities.serialised(c1);
    assertEquals(c1, c2);
}
项目:pm    文件:ChartGenerator.java   
private TimeSeriesCollection buildDataSet(SortedMap<DataSetBarDescr, SortedMap<Date,Double>> series, AbstractXYItemRenderer renderer) {

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    int seriesIdx = 0;
    for (DataSetBarDescr serieDef : series.keySet()) {

        TimeSeries timeSerie = new TimeSeries(serieDef.getSerieName());

        SortedMap<Date, Double> serie = series.get(serieDef);
        for (Date date : serie.keySet()) {
            RegularTimePeriod period = new Day(date);
            Number value = serie.get(date);
            TimeSeriesDataItem item = new TimeSeriesDataItem(period, value);
            timeSerie.add(item, false);
        }

        dataset.addSeries(timeSerie);
        renderer.setSeriesPaint(seriesIdx, serieDef.getSerieColor());
        renderer.setSeriesFillPaint(seriesIdx, serieDef.getSerieColor());
        renderer.setSeriesStroke(seriesIdx, new BasicStroke(serieDef.getSerieStrokeSize()));

        seriesIdx++;
    }

    return dataset;
}
项目:astor    文件:MovingAverageTests.java   
/**
 * Creates a sample series.
 *
 * @return A sample series.
 */
private TimeSeries createDailyTimeSeries1() {

    TimeSeries series = new TimeSeries("Series 1");
    series.add(new Day(11, MonthConstants.AUGUST, 2003), 11.2);
    series.add(new Day(13, MonthConstants.AUGUST, 2003), 13.8);
    series.add(new Day(17, MonthConstants.AUGUST, 2003), 14.1);
    series.add(new Day(18, MonthConstants.AUGUST, 2003), 12.7);
    series.add(new Day(19, MonthConstants.AUGUST, 2003), 16.5);
    series.add(new Day(20, MonthConstants.AUGUST, 2003), 15.6);
    series.add(new Day(25, MonthConstants.AUGUST, 2003), 19.8);
    series.add(new Day(27, MonthConstants.AUGUST, 2003), 10.7);
    series.add(new Day(28, MonthConstants.AUGUST, 2003), 14.3);
    return series;

}