Examples of XYBlockRenderer


Examples of org.jfree.chart.renderer.xy.XYBlockRenderer

   
    /**
     * Some tests for the findDomainBounds() method.
     */
    public void testFindDomainBounds() {
        XYBlockRenderer renderer = new XYBlockRenderer();
        assertNull(renderer.findRangeBounds(null));

        XYSeriesCollection dataset = new XYSeriesCollection();
        XYSeries series = new XYSeries("S1");
        series.add(1.0, null);
        dataset.addSeries(series);
        Range r = renderer.findDomainBounds(dataset);
        assertEquals(0.5, r.getLowerBound(), EPSILON);
        assertEquals(1.5, r.getUpperBound(), EPSILON);

        dataset.removeAllSeries();
        r = renderer.findDomainBounds(dataset);
        assertNull(r);
    }   
View Full Code Here

Examples of org.jfree.chart.renderer.xy.XYBlockRenderer

          Color temp =(Color)colorRangeMap.get(key);
          paintScale.add(zvalues[ke],temp);
          legendPaintScale.add(0.5+ke, temp);
        }    
        //Configures the renderer
        XYBlockRenderer renderer = new XYBlockRenderer();
        renderer.setPaintScale(paintScale);
        double blockHeight =  (new Double(blockH)).doubleValue();
        double blockWidth =  (new Double(blockW)).doubleValue();
        renderer.setBlockWidth(blockWidth);
        renderer.setBlockHeight(blockHeight);
       
        //configures the plot with title, subtitle, axis ecc.
        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
        plot.setBackgroundPaint(Color.white);
        plot.setDomainGridlinePaint(Color.black);
View Full Code Here

Examples of org.jfree.chart.renderer.xy.XYBlockRenderer

    NumberAxis yAxis = new NumberAxis(xLabel);
    yAxis.setUpperMargin(0.0);
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    yAxis.setRange(hourMin, hourMax);

    XYBlockRenderer renderer = new XYBlockRenderer();
    renderer.setBlockWidth(BLOCK_HEIGHT);
    // one block for each minute!
    renderer.setBlockHeight(0.017);
    //renderer.setBlockWidth(1);
    renderer.setBlockAnchor(RectangleAnchor.BOTTOM_LEFT);

//    MyXYItemLabelGenerator my=new MyXYItemLabelGenerator();
//    renderer.setItemLabelsVisible(null);
//    renderer.setSeriesItemLabelGenerator(0, my);
//    renderer.setSeriesItemLabelsVisible(0, true);

//    XYTextAnnotation annotation1 = new XYTextAnnotation(
//    "P_",1.2309372E12, 14.3);
//    XYTextAnnotation annotation2 = new XYTextAnnotation(
//    "P_",1.2308508E12, 16.3);

    for (Iterator iterator = annotations.keySet().iterator(); iterator.hasNext();) {
      String annotationCode = (String) iterator.next();
      AnnotationBlock annotationBlock=annotations.get(annotationCode);
      XYTextAnnotation xyAnnotation = new XYTextAnnotation(
          annotationBlock.getAnnotation(),annotationBlock.getXPosition()+ANNOTATION_HEIGHT, annotationBlock.getYPosition());
      if(styleAnnotation!=null){
        xyAnnotation.setFont(new Font(styleAnnotation.getFontName(),Font.BOLD,styleAnnotation.getSize()));
        xyAnnotation.setPaint(styleAnnotation.getColor());
      }
      else{
        xyAnnotation.setFont(new Font("Nome",Font.BOLD,8));       
        xyAnnotation.setPaint(Color.BLACK);
      }

      xyAnnotation.setTextAnchor(TextAnchor.BOTTOM_LEFT);
      renderer.addAnnotation(xyAnnotation);
    }

    logger.debug("Annotation set");

    LookupPaintScale paintScale = new LookupPaintScale(0.5, ranges.size()+0.5, color);
    String[] labels=new String[ranges.size()+1];
    labels[0]="";

    // ******************** SCALE ****************************
    for (Iterator iterator = ranges.iterator(); iterator.hasNext();) {
      RangeBlocks range = (RangeBlocks) iterator.next();
      Integer index=patternRangeIndex.get(range.getPattern());
      Color color=range.getColor();
      if(color!=null){
        //Paint colorTransparent=new Color(color.getRed(), color.getGreen(), color.getBlue(), 50);     
        Paint colorTransparent=null;
        if(addTransparency==true){
          colorTransparent=new Color(color.getRed(), color.getGreen(), color.getBlue(),50);     
        }
        else{
          colorTransparent=new Color(color.getRed(), color.getGreen(), color.getBlue());               
        }
        paintScale.add(index+0.5, colorTransparent);
      }
      //String insertLabel="            "+range.getLabel();
      String insertLabel=range.getLabel();     
      labels[index+1]=insertLabel;
    }
    renderer.setPaintScale(paintScale);



    SymbolAxis scaleAxis = new SymbolAxis(null, labels);
    scaleAxis.setRange(0.5, ranges.size()+0.5);
View Full Code Here

Examples of org.jfree.chart.renderer.xy.XYBlockRenderer

      numberaxis1.setLowerMargin(0.0D);
      numberaxis1.setUpperMargin(0.0D);
      numberaxis1.setAxisLinePaint(Color.white);
      numberaxis1.setTickMarkPaint(Color.white);

      XYBlockRenderer xyblockrenderer = new XYBlockRenderer();
//    System.out.println("fieldMax="+fieldMax);
//    System.out.println("fieldMax="+fieldMax);
      if(fieldMax==0.0)fieldMax=1.0;

      GrayPaintScale graypaintscale = new GrayPaintScale(0, fieldMax);
      xyblockrenderer.setPaintScale(graypaintscale);
      XYPlot xyplot = new XYPlot(show, numberaxis, numberaxis1, xyblockrenderer);

      xyplot.setBackgroundPaint(Color.lightGray);
      xyplot.setDomainGridlinesVisible(false);
      xyplot.setRangeGridlinePaint(Color.white);
View Full Code Here

Examples of org.jfree.chart.renderer.xy.XYBlockRenderer

     * Test that the equals() method distinguishes all fields.
     */
    public void testEquals() {
       
        // default instances
        XYBlockRenderer r1 = new XYBlockRenderer();
        XYBlockRenderer r2 = new XYBlockRenderer();
        assertTrue(r1.equals(r2));
        assertTrue(r2.equals(r1));
       
        // blockHeight
        r1.setBlockHeight(2.0);
        assertFalse(r1.equals(r2));
        r2.setBlockHeight(2.0);
        assertTrue(r1.equals(r2));

        // blockWidth
        r1.setBlockWidth(2.0);
        assertFalse(r1.equals(r2));
        r2.setBlockWidth(2.0);
        assertTrue(r1.equals(r2));
       
        // paintScale
        r1.setPaintScale(new GrayPaintScale(0.0, 1.0));
        assertFalse(r1.equals(r2));
        r2.setPaintScale(new GrayPaintScale(0.0, 1.0));
        assertTrue(r1.equals(r2));
       
    }
View Full Code Here

Examples of org.jfree.chart.renderer.xy.XYBlockRenderer

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

Examples of org.jfree.chart.renderer.xy.XYBlockRenderer

   
    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        XYBlockRenderer r1 = new XYBlockRenderer();
        LookupPaintScale scale1 = new LookupPaintScale();
        r1.setPaintScale(scale1);
        XYBlockRenderer r2 = null;
        try {
            r2 = (XYBlockRenderer) r1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(r1 != r2);
        assertTrue(r1.getClass() == r2.getClass());
        assertTrue(r1.equals(r2));
       
        // check independence
        scale1.add(0.5, Color.red);
        assertFalse(r1.equals(r2));
        LookupPaintScale scale2 = (LookupPaintScale) r2.getPaintScale();
        scale2.add(0.5, Color.red);
        assertTrue(r1.equals(r2));
    }
View Full Code Here

Examples of org.jfree.chart.renderer.xy.XYBlockRenderer

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

Examples of org.jfree.chart.renderer.xy.XYBlockRenderer

    /**
     * A simple test for bug 1766646.
     */
    public void testBug1766646A() {
        XYBlockRenderer r = new XYBlockRenderer();
        Range range = r.findDomainBounds(null);
        assertTrue(range == null);
        DefaultXYZDataset emptyDataset = new DefaultXYZDataset();
        range = r.findDomainBounds(emptyDataset);
        assertTrue(range == null);
    }
View Full Code Here

Examples of org.jfree.chart.renderer.xy.XYBlockRenderer

    /**
     * A simple test for bug 1766646.
     */
    public void testBug1766646B() {
        XYBlockRenderer r = new XYBlockRenderer();
        Range range = r.findRangeBounds(null);
        assertTrue(range == null);
        DefaultXYZDataset emptyDataset = new DefaultXYZDataset();
        range = r.findRangeBounds(emptyDataset);
        assertTrue(range == null);
    }
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.