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

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

Introduction

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

Prototype

public Number getX(int index) 

Source Link

Document

Returns the x-value for the specified item.

Usage

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

/**
 * Some checks for the new accessor methods added in 1.0.5.
 *//*w  ww . j  ava2  s.  co  m*/
@Test
public void testValues() {
    XYIntervalSeries s1 = new XYIntervalSeries("S1");
    s1.add(2.0, 1.0, 3.0, 5.0, 4.0, 6.0);
    assertEquals(2.0, s1.getX(0).doubleValue(), EPSILON);
    assertEquals(1.0, s1.getXLowValue(0), EPSILON);
    assertEquals(3.0, s1.getXHighValue(0), EPSILON);
    assertEquals(5.0, s1.getYValue(0), EPSILON);
    assertEquals(4.0, s1.getYLowValue(0), EPSILON);
    assertEquals(6.0, s1.getYHighValue(0), EPSILON);
}

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

/**
 * Returns the x-value for an item within a series.
 *
 * @param series  the series index./*  www .  ja  v a  2  s .c om*/
 * @param item  the item index.
 *
 * @return The x-value.
 */
@Override
public Number getX(int series, int item) {
    XYIntervalSeries s = (XYIntervalSeries) this.data.get(series);
    return s.getX(item);
}

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

/**
 * Check that the maximum item count can be applied retrospectively.
 *///from  ww  w.  ja v  a  2 s .  c om
@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);
}

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

/**
 * Simple test for the remove() method./*from www.j  av  a2  s. c  o  m*/
 */
@Test
public void testRemove() {
    XYIntervalSeries s1 = new XYIntervalSeries("Series 1");
    s1.add(1.0, 1.0, 1.0, 2.0, 1.9, 2.1);
    s1.add(2.0, 2.0, 2.0, 2.0, 1.9, 2.1);
    s1.add(3.0, 3.0, 3.0, 3.0, 2.9, 3.1);
    assertEquals(3, s1.getItemCount());

    s1.remove(new Double(2.0));
    assertEquals(new Double(3.0), s1.getX(1));

    s1.remove(new Double(1.0));
    assertEquals(new Double(3.0), s1.getX(0));
}

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

/**
 * A simple check that the maximumItemCount attribute is working.
 *//*from  w w  w. j  a v a  2s . co  m*/
@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);
}