Example usage for org.jfree.data.xy VectorSeries getXValue

List of usage examples for org.jfree.data.xy VectorSeries getXValue

Introduction

In this page you can find the example usage for org.jfree.data.xy VectorSeries getXValue.

Prototype

public double getXValue(int index) 

Source Link

Document

Returns the x-value for the specified item.

Usage

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

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

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

/**
 * Simple test for the remove() method./* w  w w  . j  a  va2 s  .c om*/
 */
@Test
public void testRemove() {
    VectorSeries s1 = new VectorSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0);
    s1.add(3.0, 3.0, 3.0, 3.0);
    s1.add(2.0, 2.0, 2.0, 2.0);
    assertEquals(3, s1.getItemCount());

    s1.remove(new XYCoordinate(2.0, 2.0));
    assertEquals(3.0, s1.getXValue(1), EPSILON);

    s1.remove(new XYCoordinate(1.0, 1.0));
    assertEquals(3.0, s1.getXValue(0), EPSILON);
}

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

/**
 * A simple check that the maximumItemCount attribute is working.
 *//*from  w  ww .j ava  2s .co  m*/
@Test
public void testSetMaximumItemCount() {
    VectorSeries s1 = new VectorSeries("S1");
    assertEquals(Integer.MAX_VALUE, s1.getMaximumItemCount());
    s1.setMaximumItemCount(2);
    assertEquals(2, s1.getMaximumItemCount());
    s1.add(1.0, 1.1, 1.1, 1.1);
    s1.add(2.0, 2.2, 2.2, 2.2);
    s1.add(3.0, 3.3, 3.3, 3.3);
    assertEquals(2.0, s1.getXValue(0), EPSILON);
    assertEquals(3.0, s1.getXValue(1), EPSILON);
}