Examples of KeyToGroupMap


Examples of org.jfree.data.KeyToGroupMap

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
        KeyToGroupMap m1 = new KeyToGroupMap("Default Group");
        KeyToGroupMap m2 = new KeyToGroupMap("Default Group");
        assertTrue(m1.equals(m2));
        assertTrue(m2.equals(m1));

        m1.mapKeyToGroup("K1", "G1");
        assertFalse(m1.equals(m2));
        m2.mapKeyToGroup("K1", "G1");
        assertTrue(m1.equals(m2));
    }
View Full Code Here

Examples of org.jfree.data.KeyToGroupMap

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        KeyToGroupMap m1 = new KeyToGroupMap("Test");
        m1.mapKeyToGroup("K1", "G1");
        KeyToGroupMap m2 = null;
        try {
            m2 = (KeyToGroupMap) m1.clone();
        }
        catch (CloneNotSupportedException e) {
            System.err.println("Failed to clone.");
        }
        assertTrue(m1 != m2);
        assertTrue(m1.getClass() == m2.getClass());
        assertTrue(m1.equals(m2));

        // a small check for independence
        m1.mapKeyToGroup("K1", "G2");
        assertFalse(m1.equals(m2));
        m2.mapKeyToGroup("K1", "G2");
        assertTrue(m1.equals(m2));
    }
View Full Code Here

Examples of org.jfree.data.KeyToGroupMap

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {

        KeyToGroupMap m1 = new KeyToGroupMap("Test");
        KeyToGroupMap m2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(m1);
View Full Code Here

Examples of org.jfree.data.KeyToGroupMap

    /**
     * Creates a new renderer.
     */
    public GroupedStackedBarRenderer() {
        super();
        this.seriesToGroupMap = new KeyToGroupMap();
    }
View Full Code Here

Examples of org.jfree.data.KeyToGroupMap

    /**
     * Tests the mapKeyToGroup() method.
     */
    public void testMapKeyToGroup() {
        KeyToGroupMap m1 = new KeyToGroupMap("G1");

        // map a key to the default group
        m1.mapKeyToGroup("K1", "G1");
        assertEquals("G1", m1.getGroup("K1"));

        // map a key to a new group
        m1.mapKeyToGroup("K2", "G2");
        assertEquals("G2", m1.getGroup("K2"));

        // clear a mapping
        m1.mapKeyToGroup("K2", null);
        assertEquals("G1", m1.getGroup("K2"))// after clearing, reverts to
                                                // default group

        // check handling of null key
        boolean pass = false;
        try {
            m1.mapKeyToGroup(null, "G1");
        }
        catch (IllegalArgumentException e) {
            pass = true;
        }
        assertTrue(pass);
View Full Code Here

Examples of org.jfree.data.KeyToGroupMap

        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));
    }
View Full Code Here

Examples of org.jfree.data.KeyToGroupMap

        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));
View Full Code Here

Examples of org.jfree.data.KeyToGroupMap

    plot.setRangeGridlinePaint(Color.white);
    plot.setDomainGridlinePaint(Color.white);
    plot.setDomainGridlinesVisible(true);

    GroupedStackedBarRenderer renderer = new GroupedStackedBarRenderer();
    KeyToGroupMap map = new KeyToGroupMap("G1");
    int numElForGroup = 0;
    for (int idx=0; idx < numGroups.intValue(); idx++){
      for (int j=0; j < numSerieForGroup.intValue(); j++ ){
        try{
          String tmpSubCat = (String)subCategoryNames.get(j+idx*numSerieForGroup.intValue());
          map.mapKeyToGroup(tmpSubCat, "G"+(idx+1));

        }
        catch (Exception e) {
          logger.error("out of range error in inserting in stacked bar group: continue anayway", e);
        }
View Full Code Here

Examples of org.jfree.data.KeyToGroupMap

     * Some checks for the findStackedRangeBounds(CategoryDataset,
     * KeyToGroupMap) method.
     */
    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);

View Full Code Here

Examples of org.jfree.data.KeyToGroupMap

    /**
     * Tests the stacked range extent calculation.
     */
    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);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.