Example usage for org.jfree.data.category SlidingCategoryDataset getRowIndex

List of usage examples for org.jfree.data.category SlidingCategoryDataset getRowIndex

Introduction

In this page you can find the example usage for org.jfree.data.category SlidingCategoryDataset getRowIndex.

Prototype

@Override
public int getRowIndex(Comparable key) 

Source Link

Document

Returns the row index for a given key.

Usage

From source file:org.jfree.data.category.SlidingCategoryDatasetTest.java

/**
 * Some checks for the getRowIndex() method.
 *//*from w  w w  .java 2s  .  co  m*/
@Test
public void testGetRowIndex() {
    DefaultCategoryDataset underlying = new DefaultCategoryDataset();
    underlying.addValue(1.0, "R1", "C1");
    underlying.addValue(2.0, "R2", "C1");
    underlying.addValue(3.0, "R3", "C1");
    underlying.addValue(4.0, "R4", "C1");
    SlidingCategoryDataset dataset = new SlidingCategoryDataset(underlying, 1, 2);
    assertEquals(0, dataset.getRowIndex("R1"));
    assertEquals(1, dataset.getRowIndex("R2"));
    assertEquals(2, dataset.getRowIndex("R3"));
    assertEquals(3, dataset.getRowIndex("R4"));
}