Package org.jfree.chart.renderer.category

Examples of org.jfree.chart.renderer.category.ScatterRenderer


    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {
        ScatterRenderer r1 = new ScatterRenderer();
        ScatterRenderer r2 = null;
        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(r1);
            out.close();
View Full Code Here


    /**
     * Some checks for the findRangeBounds() method.
     */
    public void testFindRangeBounds() {
        ScatterRenderer r = new ScatterRenderer();
        assertNull(r.findRangeBounds(null));

        // an empty dataset should return a null range
        DefaultMultiValueCategoryDataset dataset
                = new DefaultMultiValueCategoryDataset();
        assertNull(r.findRangeBounds(dataset));

        List values = Arrays.asList(new Double[] {new Double(1.0)});
        dataset.add(values, "R1", "C1");
        assertEquals(new Range(1.0, 1.0), r.findRangeBounds(dataset));

        values = Arrays.asList(new Double[] {new Double(2.0), new Double(2.2)});
        dataset.add(values, "R1", "C2");
        assertEquals(new Range(1.0, 2.2), r.findRangeBounds(dataset));

        values = Arrays.asList(new Double[] {new Double(-3.0),
                new Double(-3.2)});
        dataset.add(values, "R1", "C3");
        assertEquals(new Range(-3.2, 2.2), r.findRangeBounds(dataset));

        values = Arrays.asList(new Double[] {new Double(6.0)});
        dataset.add(values, "R2", "C1");
        assertEquals(new Range(-3.2, 6.0), r.findRangeBounds(dataset));

        r.setSeriesVisible(1, Boolean.FALSE);
        assertEquals(new Range(-3.2, 2.2), r.findRangeBounds(dataset));
    }
View Full Code Here

     * @return Charte for single unit electrode
     */
    private  JFreeChart createSUChart(MultiValueCategoryDataset multivaluecategorydataset)
    ////////////////////////////////////////////////////////////////////////
    {
      ScatterRenderer shape = new ScatterRenderer();
      suRender = shape;
      for(int i=0; i < suSeries; i++)
      {
        if(i==nowValue)
        {
          suRender.setSeriesVisible(i, new Boolean(true));
        }
        else
        {
          suRender.setSeriesVisible(i, new Boolean(false));
        }
        shape.setSeriesShape(i, new Rectangle(2, 4));
        shape.setSeriesShape(i, new Rectangle(2, 4));
      }

      CategoryPlot categoryplot = new CategoryPlot(multivaluecategorydataset, new CategoryAxis("Trial"), new NumberAxis("Time"), shape);
      categoryplot.setBackgroundPaint(Color.lightGray);
      categoryplot.setOrientation(PlotOrientation.HORIZONTAL);
View Full Code Here

    /**
     * Test that the equals() method distinguishes all fields.
     */
    public void testEquals() {
       
        ScatterRenderer r1 = new ScatterRenderer();
        ScatterRenderer r2 = new ScatterRenderer();
        assertEquals(r1, r2);
       
        r1.setSeriesShapesFilled(1, true);
        assertFalse(r1.equals(r2));
        r2.setSeriesShapesFilled(1, true);
        assertTrue(r1.equals(r2));
       
        r1.setBaseShapesFilled(false);
        assertFalse(r1.equals(r2));
        r2.setBaseShapesFilled(false);
        assertTrue(r1.equals(r2));
       
        r1.setUseFillPaint(true);
        assertFalse(r1.equals(r2));
        r2.setUseFillPaint(true);
        assertTrue(r1.equals(r2));
       
        r1.setDrawOutlines(true);
        assertFalse(r1.equals(r2));
        r2.setDrawOutlines(true);
        assertTrue(r1.equals(r2));
       
        r1.setUseOutlinePaint(true);
        assertFalse(r1.equals(r2));
        r2.setUseOutlinePaint(true);
        assertTrue(r1.equals(r2));
       
        r1.setUseSeriesOffset(false);
        assertFalse(r1.equals(r2));
        r2.setUseSeriesOffset(false);
        assertTrue(r1.equals(r2));
       
    }
View Full Code Here

    /**
     * Two objects that are equal are required to return the same hashCode.
     */
    public void testHashcode() {
        ScatterRenderer r1 = new ScatterRenderer();
        ScatterRenderer r2 = new ScatterRenderer();
        assertTrue(r1.equals(r2));
        int h1 = r1.hashCode();
        int h2 = r2.hashCode();
        assertEquals(h1, h2);
    }
View Full Code Here

   
    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        ScatterRenderer r1 = new ScatterRenderer();
        ScatterRenderer r2 = null;
        try {
            r2 = (ScatterRenderer) r1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(r1 != r2);
        assertTrue(r1.getClass() == r2.getClass());
        assertTrue(r1.equals(r2));
       
        assertTrue(checkIndependence(r1, r2));
       
    }
View Full Code Here

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

        ScatterRenderer r1 = new ScatterRenderer();
        ScatterRenderer r2 = null;

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

     */
    private static JFreeChart createChart(final MultiValueCategoryDataset
            dataset, final DatasetSelectionExtension<CategoryCursor
                    <String, String>> ext) {

        ScatterRenderer r = new ScatterRenderer();
        CategoryPlot plot = new CategoryPlot(dataset, new CategoryAxis(
                "Category"), new NumberAxis("Value"), r);
        plot.setBackgroundColor(Color.LIGHT_GRAY);
        plot.setDomainGridlinePaint(Color.white);
        plot.setRangeGridlinePaint(Color.white);
        plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));
        JFreeChart chart = new JFreeChart("ScatterRendererDemo1", plot);
        ChartUtilities.applyCurrentTheme(chart);
      
        //register the plot
        ext.addChangeListener(plot);         
         
        //illustrates the usage of a shape item rendering strategy
        final CategoryCursor<String, String> cursor = new CategoryCursor<String,
                String>();
        r.setShapeIRS(new DefaultShapeIRS(r) {
            private static final long serialVersionUID = 1L;

            @Override
            public Shape getItemShape(int row, int column) {
                cursor.setPosition((String)dataset.getRowKey(row),
View Full Code Here

TOP

Related Classes of org.jfree.chart.renderer.category.ScatterRenderer

Copyright © 2018 www.massapicom. 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.