Example usage for org.jfree.data.xy XYIntervalSeries setMaximumItemCount

List of usage examples for org.jfree.data.xy XYIntervalSeries setMaximumItemCount

Introduction

In this page you can find the example usage for org.jfree.data.xy XYIntervalSeries setMaximumItemCount.

Prototype

public void setMaximumItemCount(int maximum) 

Source Link

Document

Sets the maximum number of items that will be retained in the series.

Usage

From source file:org.jfree.data.xy.XYIntervalSeriesTest.java

/**
 * A simple check that the maximumItemCount attribute is working.
 *//*from  www.  j a  va  2 s. c  om*/
@Test
public void testSetMaximumItemCount() {
    XYIntervalSeries s1 = new XYIntervalSeries("S1");
    assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount());
    s1.setMaximumItemCount(2);
    assertEquals(2, s1.getMaximumItemCount());
    s1.add(1.0, 1.1, 1.1, 1.1, 1.1, 1.1);
    s1.add(2.0, 2.2, 2.2, 2.2, 2.2, 2.2);
    s1.add(3.0, 3.3, 3.3, 3.3, 3.3, 3.3);
    assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
    assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
}

From source file:org.jfree.data.xy.XYIntervalSeriesTest.java

/**
 * Check that the maximum item count can be applied retrospectively.
 *///  ww w.j ava 2  s  .com
@Test
public void testSetMaximumItemCount2() {
    XYIntervalSeries s1 = new XYIntervalSeries("S1");
    s1.add(1.0, 1.1, 1.1, 1.1, 1.1, 1.1);
    s1.add(2.0, 2.2, 2.2, 2.2, 2.2, 2.2);
    s1.add(3.0, 3.3, 3.3, 3.3, 2.2, 2.2);
    s1.setMaximumItemCount(2);
    assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
    assertEquals(3.0, s1.getX(1).doubleValue(), EPSILON);
}