當前位置: 首頁>>代碼示例>>Java>>正文


Java TimeSeries.setMaximumItemCount方法代碼示例

本文整理匯總了Java中org.jfree.data.time.TimeSeries.setMaximumItemCount方法的典型用法代碼示例。如果您正苦於以下問題:Java TimeSeries.setMaximumItemCount方法的具體用法?Java TimeSeries.setMaximumItemCount怎麽用?Java TimeSeries.setMaximumItemCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.data.time.TimeSeries的用法示例。


在下文中一共展示了TimeSeries.setMaximumItemCount方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testSetMaximumItemCount

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Test the setMaximumItemCount() method to ensure that it removes items from the series
 * if necessary.
 */
public void testSetMaximumItemCount() {

    TimeSeries s1 = new TimeSeries("S1", Year.class);
    s1.add(new Year(2000), 13.75);
    s1.add(new Year(2001), 11.90);
    s1.add(new Year(2002), null);
    s1.add(new Year(2005), 19.32);
    s1.add(new Year(2007), 16.89);

    assertTrue(s1.getItemCount() == 5);
    s1.setMaximumItemCount(3);
    assertTrue(s1.getItemCount() == 3);
    TimeSeriesDataItem item = s1.getDataItem(0);
    assertTrue(item.getPeriod().equals(new Year(2002)));

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:21,代碼來源:TimeSeriesTests.java

示例2: testSetMaximumItemCount

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Test the setMaximumItemCount() method to ensure that it removes items 
 * from the series if necessary.
 */
public void testSetMaximumItemCount() {

    TimeSeries s1 = new TimeSeries("S1", Year.class);
    s1.add(new Year(2000), 13.75);
    s1.add(new Year(2001), 11.90);
    s1.add(new Year(2002), null);
    s1.add(new Year(2005), 19.32);
    s1.add(new Year(2007), 16.89);

    assertTrue(s1.getItemCount() == 5);
    s1.setMaximumItemCount(3);
    assertTrue(s1.getItemCount() == 3);
    TimeSeriesDataItem item = s1.getDataItem(0);
    assertTrue(item.getPeriod().equals(new Year(2002)));

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:21,代碼來源:TimeSeriesTests.java

示例3: testSetMaximumItemCount

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Test the setMaximumItemCount() method to ensure that it removes items
 * from the series if necessary.
 */
public void testSetMaximumItemCount() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.add(new Year(2000), 13.75);
    s1.add(new Year(2001), 11.90);
    s1.add(new Year(2002), null);
    s1.add(new Year(2005), 19.32);
    s1.add(new Year(2007), 16.89);
    assertTrue(s1.getItemCount() == 5);

    s1.setMaximumItemCount(3);
    assertTrue(s1.getItemCount() == 3);
    TimeSeriesDataItem item = s1.getDataItem(0);
    assertTrue(item.getPeriod().equals(new Year(2002)));
    assertEquals(16.89, s1.getMinY(), EPSILON);
    assertEquals(19.32, s1.getMaxY(), EPSILON);
}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:21,代碼來源:TimeSeriesTests.java

示例4: addData

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * This method adds the specified stream elements to the timeSeries of the
 * appropriate plot.
 * 
 * @param streamElement
 */
public synchronized void addData ( StreamElement streamElement ) {
   for ( int i = 0 ; i < streamElement.getFieldNames( ).length ; i++ ) {
      TimeSeries timeSeries = dataForTheChart.get( streamElement.getFieldNames( )[ i ] );
      if ( timeSeries == null ) {
         dataForTheChart.put( streamElement.getFieldNames( )[ i ] , timeSeries = new TimeSeries( streamElement.getFieldNames( )[ i ] , org.jfree.data.time.FixedMillisecond.class ) );
         if(isTimeBased){
         	timeSeries.setMaximumItemAge(historySize);
         }else{
             timeSeries.setMaximumItemCount(historySize);
         }
         dataCollectionForTheChart.addSeries( timeSeries );
      }
      try {
         timeSeries.addOrUpdate( new FixedMillisecond( new Date( streamElement.getTimeStamp( ) ) ) , Double.parseDouble( streamElement.getData( )[ i ].toString( ) ) );
      } catch ( SeriesException e ) {
         logger.warn( e.getMessage( ) , e );
      }
      
   }
   changed = true;
}
 
開發者ID:LSIR,項目名稱:gsn,代碼行數:28,代碼來源:ChartVirtualSensor.java

示例5: testEquals

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Tests the equals method.
 */
public void testEquals() {
    final TimeSeries s1 = new TimeSeries("Time Series 1");
    final TimeSeries s2 = new TimeSeries("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);

    s1.setMaximumItemCount(100);
    final boolean b5 = s1.equals(s2);
    assertFalse("b5", b5);

    s2.setMaximumItemCount(100);
    final boolean b6 = s1.equals(s2);
    assertTrue("b6", b6);

    s1.setHistoryCount(100);
    final boolean b7 = s1.equals(s2);
    assertFalse("b7", b7);

    s2.setHistoryCount(100);
    final boolean b8 = s1.equals(s2);
    assertTrue("b8", b8);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:42,代碼來源:TimeSeriesTests.java

示例6: testAddOrUpdate

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Some checks for the addOrUpdate() method.
 */
public void testAddOrUpdate() {
    TimeSeries s1 = new TimeSeries("S1", Year.class);
    s1.setMaximumItemCount(2);
    s1.addOrUpdate(new Year(2000), 100.0);
    assertEquals(1, s1.getItemCount());
    s1.addOrUpdate(new Year(2001), 101.0);
    assertEquals(2, s1.getItemCount());
    s1.addOrUpdate(new Year(2001), 102.0);
    assertEquals(2, s1.getItemCount());
    s1.addOrUpdate(new Year(2002), 103.0);
    assertEquals(2, s1.getItemCount());
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:16,代碼來源:TimeSeriesTests.java

示例7: testEquals

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Tests the equals method.
 */
public void testEquals() {
    TimeSeries s1 = new TimeSeries("Time Series 1");
    TimeSeries s2 = new TimeSeries("Time Series 2");
    boolean b1 = s1.equals(s2);
    assertFalse("b1", b1);

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

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

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

    s1.setMaximumItemCount(100);
    boolean b5 = s1.equals(s2);
    assertFalse("b5", b5);

    s2.setMaximumItemCount(100);
    boolean b6 = s1.equals(s2);
    assertTrue("b6", b6);

    s1.setMaximumItemAge(100);
    boolean b7 = s1.equals(s2);
    assertFalse("b7", b7);

    s2.setMaximumItemAge(100);
    boolean b8 = s1.equals(s2);
    assertTrue("b8", b8);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:42,代碼來源:TimeSeriesTests.java

示例8: testAddOrUpdate

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Some checks for the addOrUpdate() method.
 */
public void testAddOrUpdate() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.setMaximumItemCount(2);
    s1.addOrUpdate(new Year(2000), 100.0);
    assertEquals(1, s1.getItemCount());
    s1.addOrUpdate(new Year(2001), 101.0);
    assertEquals(2, s1.getItemCount());
    s1.addOrUpdate(new Year(2001), 102.0);
    assertEquals(2, s1.getItemCount());
    s1.addOrUpdate(new Year(2002), 103.0);
    assertEquals(2, s1.getItemCount());
}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:16,代碼來源:TimeSeriesTests.java

示例9: testAddOrUpdate2

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Test the add branch of the addOrUpdate() method.
 */
public void testAddOrUpdate2() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.setMaximumItemCount(2);
    s1.addOrUpdate(new Year(2010), 1.1);
    s1.addOrUpdate(new Year(2011), 2.2);
    s1.addOrUpdate(new Year(2012), 3.3);
    assertEquals(2, s1.getItemCount());
    assertEquals(2.2, s1.getMinY(), EPSILON);
    assertEquals(3.3, s1.getMaxY(), EPSILON);
}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:14,代碼來源:TimeSeriesTests.java

示例10: testAdd

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
/**
 * Check that the item bounds are determined correctly when there is a
 * maximum item count and a new value is added.
 */
public void testAdd() {
    TimeSeries s1 = new TimeSeries("S1");
    s1.setMaximumItemCount(2);
    s1.add(new Year(2010), 1.1);
    s1.add(new Year(2011), 2.2);
    s1.add(new Year(2012), 3.3);
    assertEquals(2, s1.getItemCount());
    assertEquals(2.2, s1.getMinY(), EPSILON);
    assertEquals(3.3, s1.getMaxY(), EPSILON);
}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:15,代碼來源:TimeSeriesTests.java

示例11: addDataSource

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
public void addDataSource(DataSourceSampler dss, String name, DataSource src) {
  TimeSeries ts = new TimeSeries(name, Millisecond.class);
  ts.setMaximumItemCount(200);
  addTimeSeries(ts);
  dss.addDataSource(src, ts);
}
 
開發者ID:PERSISTLab,項目名稱:BatterylessSim,代碼行數:7,代碼來源:DataChart.java

示例12: addSeries

import org.jfree.data.time.TimeSeries; //導入方法依賴的package包/類
public void addSeries(final String name, double[] data, Paint linePaint){
//System.out.println("TimeGraphPanel: Adding series to graph " + title +  ", series name = " + name + "=" + Utils.arrayString(data));
		TimeSeries timeSeries = new TimeSeries(name, Week.class);
		timeSeries.setMaximumItemCount(Time.WEEKS_YEAR);
		timeSeries.removeAgedItems(true);
		if(data != null){
			for(int j = 0; j < data.length; j++){
				timeSeries.add(new Week(j % Time.WEEKS_YEAR, 1900 + (int)(j / Time.WEEKS_YEAR)), data[j]);
			}
		}
		addSeries(name, timeSeries, linePaint);
		// Add checkbox if editable, label otherwise
		JComponent kItem = null;
		if(editable){
			final JCheckBox c = new JCheckBox(drawLegend ? name : null);
			c.setSelected(true);
			c.addActionListener(new ActionListener(){
				public void actionPerformed(ActionEvent e){
					setVisible(name, c.isSelected());
				}
			});
			selectBoxes.put(name, c);
			kItem = c;
		}
		else kItem = new JLabel(drawLegend ? name : " ");
		kItem.setToolTipText(name);
		Paint p = seriesPaint.get(name);
		if(p != null && p instanceof Color){
			if(drawLegend) kItem.setForeground((Color)p);
			else kItem.setBackground((Color)p);
		}
		if(!drawLegend){
			kItem.setOpaque(true);
			kItem.setPreferredSize(new Dimension(19, 18));
		}
//		kItem.setMinimumSize(new Dimension(15, 15));
//		kItem.setMaximumSize(new Dimension(15, 15));
		lpLayout.setConstraints(kItem, lpC);
		legandPanel.add(kItem);
//		kItem.setPreferredSize(new Dimension(kItem.getPreferredSize().width, 15));
	}
 
開發者ID:Cride5,項目名稱:jablus,代碼行數:42,代碼來源:TimeGraphPanel.java


注:本文中的org.jfree.data.time.TimeSeries.setMaximumItemCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。