本文整理汇总了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)));
}
示例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)));
}
示例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);
}
示例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;
}
示例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);
}
示例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());
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}