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

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

Introduction

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

Prototype

@Override
public Number getValue(int row, int column) 

Source Link

Document

Returns a value from the table.

Usage

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

/**
 * Some checks for the getValue() method.
 *///  w w  w .  ja v a  2s  .co  m
@Test
public void testGetValue() {
    DefaultCategoryDataset underlying = new DefaultCategoryDataset();
    underlying.addValue(1.0, "R1", "C1");
    underlying.addValue(2.0, "R1", "C2");
    underlying.addValue(3.0, "R1", "C3");
    underlying.addValue(4.0, "R1", "C4");
    SlidingCategoryDataset dataset = new SlidingCategoryDataset(underlying, 1, 2);
    assertEquals(new Double(2.0), dataset.getValue("R1", "C2"));
    assertEquals(new Double(3.0), dataset.getValue("R1", "C3"));
    boolean pass = false;
    try {
        dataset.getValue("R1", "C1");
    } catch (UnknownKeyException e) {
        pass = true;
    }
    assertTrue(pass);

    pass = false;
    try {
        dataset.getValue("R1", "C4");
    } catch (UnknownKeyException e) {
        pass = true;
    }
    assertTrue(pass);
}