use of org.jfree.data.KeyToGroupMap in project SIMVA-SoS by SESoS.
the class DatasetUtilitiesTest method testFindStackedRangeBounds_CategoryDataset3.
/**
* Some checks for the findStackedRangeBounds(CategoryDataset,
* KeyToGroupMap) method.
*/
@Test
public void testFindStackedRangeBounds_CategoryDataset3() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
KeyToGroupMap map = new KeyToGroupMap("Group A");
Range r = DatasetUtilities.findStackedRangeBounds(dataset, map);
assertTrue(r == null);
dataset.addValue(1.0, "R1", "C1");
dataset.addValue(2.0, "R2", "C1");
dataset.addValue(3.0, "R3", "C1");
dataset.addValue(4.0, "R4", "C1");
map.mapKeyToGroup("R1", "Group A");
map.mapKeyToGroup("R2", "Group A");
map.mapKeyToGroup("R3", "Group B");
map.mapKeyToGroup("R4", "Group B");
r = DatasetUtilities.findStackedRangeBounds(dataset, map);
assertEquals(0.0, r.getLowerBound(), EPSILON);
assertEquals(7.0, r.getUpperBound(), EPSILON);
dataset.addValue(null, "R5", "C1");
r = DatasetUtilities.findStackedRangeBounds(dataset, map);
assertEquals(0.0, r.getLowerBound(), EPSILON);
assertEquals(7.0, r.getUpperBound(), EPSILON);
dataset.addValue(Double.NaN, "R6", "C1");
r = DatasetUtilities.findStackedRangeBounds(dataset, map);
assertEquals(0.0, r.getLowerBound(), EPSILON);
assertEquals(7.0, r.getUpperBound(), EPSILON);
}
use of org.jfree.data.KeyToGroupMap in project SIMVA-SoS by SESoS.
the class DatasetUtilitiesTest method testStackedRangeWithMap.
/**
* Tests the stacked range extent calculation.
*/
@Test
public void testStackedRangeWithMap() {
CategoryDataset d = createCategoryDataset1();
KeyToGroupMap map = new KeyToGroupMap("G0");
map.mapKeyToGroup("R2", "G1");
Range r = DatasetUtilities.findStackedRangeBounds(d, map);
assertEquals(0.0, r.getLowerBound(), EPSILON);
assertEquals(9.0, r.getUpperBound(), EPSILON);
}
use of org.jfree.data.KeyToGroupMap in project SIMVA-SoS by SESoS.
the class GroupedStackedBarRendererTest method testEquals.
/**
* Test that the equals() method distinguishes all fields.
*/
@Test
public void testEquals() {
GroupedStackedBarRenderer r1 = new GroupedStackedBarRenderer();
GroupedStackedBarRenderer r2 = new GroupedStackedBarRenderer();
assertTrue(r1.equals(r2));
assertTrue(r2.equals(r1));
// map
KeyToGroupMap m1 = new KeyToGroupMap("G1");
m1.mapKeyToGroup("S1", "G2");
r1.setSeriesToGroupMap(m1);
assertFalse(r1.equals(r2));
KeyToGroupMap m2 = new KeyToGroupMap("G1");
m2.mapKeyToGroup("S1", "G2");
r2.setSeriesToGroupMap(m2);
assertTrue(r1.equals(r2));
}
use of org.jfree.data.KeyToGroupMap in project SIMVA-SoS by SESoS.
the class GroupedStackedBarRendererTest method testFindRangeBounds.
/**
* Some checks for the findRangeBounds() method.
*/
@Test
public void testFindRangeBounds() {
GroupedStackedBarRenderer r = new GroupedStackedBarRenderer();
assertNull(r.findRangeBounds(null));
// an empty dataset should return a null range
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
assertNull(r.findRangeBounds(dataset));
dataset.addValue(1.0, "R1", "C1");
assertEquals(new Range(0.0, 1.0), r.findRangeBounds(dataset));
dataset.addValue(-2.0, "R1", "C2");
assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset));
dataset.addValue(null, "R1", "C3");
assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset));
KeyToGroupMap m = new KeyToGroupMap("G1");
m.mapKeyToGroup("R1", "G1");
m.mapKeyToGroup("R2", "G1");
m.mapKeyToGroup("R3", "G2");
r.setSeriesToGroupMap(m);
dataset.addValue(0.5, "R3", "C1");
assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset));
dataset.addValue(5.0, "R3", "C2");
assertEquals(new Range(-2.0, 5.0), r.findRangeBounds(dataset));
}
Aggregations