Package org.jfree.chart.plot.dial

Examples of org.jfree.chart.plot.dial.DialBackground


    DialPlot plot = new DialPlot();
    logger.debug("Created new DialPlot");
   
    plot.setDataset((ValueDataset)dataset);
    plot.setDialFrame(new StandardDialFrame());
    plot.setBackground(new DialBackground());
   
   
    if(dialtextuse){
      //Usually it shoudn'tbe used. It is a type of title written into the graph
      DialTextAnnotation annotation1 = new DialTextAnnotation(dialtext);     
      annotation1.setFont(styleTitle.getFont());
      annotation1.setRadius(0.7);
      plot.addLayer(annotation1);
    }
   
    DialValueIndicator dvi = new DialValueIndicator(0);
    plot.addLayer(dvi);

    increment = (upper-lower)/10;
    StandardDialScale scale = new StandardDialScale(lower, upper, -120, -300, 10.0, 4);
//    if (!( increment > 0)){
//      increment = 0.01;
//    }
    scale.setMajorTickIncrement(increment);
    logger.debug("Setted the unit after which a new MajorTickline will be drawed");
    scale.setMinorTickCount(minorTickCount);
    logger.debug("Setted the number of MinorTickLines between every MajorTickline");
    scale.setTickRadius(0.88);
    scale.setTickLabelOffset(0.15);
    Font f =new Font("Arial",Font.PLAIN,11);
    scale.setTickLabelFont(f);
    plot.addScale(0, scale);
    plot.addPointer(new DialPointer.Pin());
   
    DialCap cap = new DialCap();
    plot.setCap(cap);

    // sets intervals
    for (Iterator iterator = intervals.iterator(); iterator.hasNext();) {
      KpiInterval interval = (KpiInterval) iterator.next();
      StandardDialRange range = new StandardDialRange(interval.getMin(), interval.getMax(), interval.getColor());
      range.setInnerRadius(0.52);
      range.setOuterRadius(0.55);
      plot.addLayer(range);
      logger.debug("new range added to the plot");
    }

    GradientPaint gp = new GradientPaint(new Point(),new Color(255, 255, 255), new Point(), new Color(170, 170, 220));
    DialBackground db = new DialBackground(gp);
    db.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
    plot.setBackground(db);
    plot.removePointer(0);
   
    DialPointer.Pointer p = new DialPointer.Pointer();
    //Pointer color
View Full Code Here


    plot.setDialFrame(dialFrame);

    GradientPaint gp = new GradientPaint(new Point(),
        new Color(255, 255, 255), new Point(),
        new Color(240, 240, 240));
    DialBackground sdb = new DialBackground(gp);

    GradientPaintTransformType gradientPaintTransformType=GradientPaintTransformType.VERTICAL;
    if(horizontalView){
      gradientPaintTransformType=GradientPaintTransformType.HORIZONTAL;
    }

    sdb.setGradientPaintTransformer(new StandardGradientPaintTransformer(
        gradientPaintTransformType));
    plot.addLayer(sdb);

    if(! ( increment > 0) ){
      logger.warn("increment cannot be less than 0, put default to 0.1 ");
View Full Code Here

        i++;
      }
         
      plot.setDialFrame(new StandardDialFrame());
 
      plot.setBackground(new DialBackground());
     
      if(dialtextuse){
        DialTextAnnotation annotation1 = new DialTextAnnotation(dialtext);     
        annotation1.setFont(styleTitle.getFont());
        annotation1.setRadius(0.7);
 
        plot.addLayer(annotation1);
      }
     
      StandardDialScale scale = new StandardDialScale(lower,
          upper, -120, -300, 10.0, 4);
     
      if(! ( increment > 0) ){
        logger.warn("increment cannot be less than 0, put default to 0.1 ");
        increment=0.1;
      }
     
      scale.setMajorTickIncrement(increment);
      scale.setMinorTickCount(minorTickCount);
      scale.setTickRadius(0.88);
      scale.setTickLabelOffset(0.15);
      //set tick label style
      scale.setTickLabelsVisible(true);
      Font tickLabelsFont = new Font(labelsTickStyle.getFontName(), Font.PLAIN, labelsTickStyle.getSize());
      scale.setTickLabelFont(tickLabelsFont);
      scale.setTickLabelPaint(labelsTickStyle.getColor());
     
     
      plot.addScale(0, scale);
 
      DialCap cap = new DialCap();
      plot.setCap(cap);
 
      // sets intervals
      for (Iterator iterator = intervals.iterator(); iterator.hasNext();) {
        KpiInterval interval = (KpiInterval) iterator.next();
        StandardDialRange range = new StandardDialRange(interval.getMin(), interval.getMax(),
            interval.getColor());
        range.setInnerRadius(0.50);
        range.setOuterRadius(0.85);
       
        range.setPaint(interval.getColor());
       
        plot.addLayer(range);
 
      }

      plot.setBackground(new DialBackground());

      logger.debug("Set values color");
      Vector arValuesName =  getValuesNames();
      legendItems = new LegendItemCollection();
      for (int j = 0; j < arValuesName.size(); j++) {
View Full Code Here

    DialPlot plot = new DialPlot();
    plot.setDataset((ValueDataset)dataset);
    plot.setDialFrame(new StandardDialFrame());

    plot.setBackground(new DialBackground());
    if(dialtextuse){
      DialTextAnnotation annotation1 = new DialTextAnnotation(dialtext);     
      annotation1.setFont(styleTitle.getFont());
      annotation1.setRadius(0.7);

      plot.addLayer(annotation1);
    }

    DialValueIndicator dvi = new DialValueIndicator(0);
    dvi.setFont(new Font(labelsValueStyle.getFontName(), Font.PLAIN, labelsValueStyle.getSize()));
    dvi.setPaint(labelsValueStyle.getColor());
    plot.addLayer(dvi);

    StandardDialScale scale = new StandardDialScale(lower,
        upper, -120, -300, 10.0, 4);

    if (!( increment > 0)){
      logger.warn("increment cannot be less than 0, put default to 0.1");
      increment = 0.01;
    }

    scale.setMajorTickIncrement(increment);

//    if (!( minorTickCount > 0)){
//      logger.warn("minor tick count cannot be less than 0, put default to 1");
//      minorTickCount = 1;
//    }

    scale.setMinorTickCount(minorTickCount);
    scale.setTickRadius(0.88);
    scale.setTickLabelOffset(0.15);
    //set tick label style
    Font tickLabelsFont = new Font(labelsTickStyle.getFontName(), Font.PLAIN, labelsTickStyle.getSize());
    scale.setTickLabelFont(tickLabelsFont);
    scale.setTickLabelPaint(labelsTickStyle.getColor());
    plot.addScale(0, scale);

    plot.addPointer(new DialPointer.Pin());

    DialCap cap = new DialCap();
    plot.setCap(cap);

    // sets intervals
    for (Iterator iterator = intervals.iterator(); iterator.hasNext();) {
      KpiInterval interval = (KpiInterval) iterator.next();
      StandardDialRange range = new StandardDialRange(interval.getMin(), interval.getMax(),
          interval.getColor());
      range.setInnerRadius(0.52);
      range.setOuterRadius(0.55);
      plot.addLayer(range);

    }

    GradientPaint gp = new GradientPaint(new Point(),
        new Color(255, 255, 255), new Point(),
        new Color(170, 170, 220));
    DialBackground db = new DialBackground(gp);
    db.setGradientPaintTransformer(new StandardGradientPaintTransformer(
        GradientPaintTransformType.VERTICAL));
    plot.setBackground(db);

    plot.removePointer(0);
    DialPointer.Pointer p = new DialPointer.Pointer();
View Full Code Here

     
        GradientPaint gp = new GradientPaint(new Point(),
                new Color(255, 255, 255), new Point(),
                new Color(170, 170, 220));
       
        DialBackground db = new DialBackground(gp);
       
        db.setGradientPaintTransformer(new StandardGradientPaintTransformer(
                GradientPaintTransformType.CENTER_HORIZONTAL));
        plot.setBackground(db);
       
       
        StandardDialScale scale = new StandardDialScale();
View Full Code Here

        GradientPaint gp = new GradientPaint(new Point(),
                new Color(255, 255, 255), new Point(),
                new Color(170, 170, 220));

        DialBackground db = new DialBackground(gp);

        db.setGradientPaintTransformer(new StandardGradientPaintTransformer(
                GradientPaintTransformType.CENTER_HORIZONTAL));
        plot.setBackground(db);


        StandardDialScale scale = new StandardDialScale();
View Full Code Here

        GradientPaint gp = new GradientPaint(new Point(),
                new Color(255, 255, 255), new Point(),
                new Color(170, 170, 220));

      
        DialBackground db = new DialBackground(gp);
        db.setGradientPaintTransformer(new StandardGradientPaintTransformer(
                GradientPaintTransformType.CENTER_HORIZONTAL));
        plot.setBackground(db);


        StandardDialScale scale = new StandardDialScale();
View Full Code Here

    /**
     * Confirm that the equals method can distinguish all the required fields.
     */
    public void testEquals() {
        DialBackground b1 = new DialBackground();
        DialBackground b2 = new DialBackground();
        assertTrue(b1.equals(b2));
       
        // paint
        b1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f,
                Color.yellow));
        assertFalse(b1.equals(b2));
        b2.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f,
                Color.yellow));
        assertTrue(b1.equals(b2));
       
        // gradient paint transformer
        b1.setGradientPaintTransformer(new StandardGradientPaintTransformer(
                GradientPaintTransformType.CENTER_VERTICAL));
        assertFalse(b1.equals(b2));
        b2.setGradientPaintTransformer(new StandardGradientPaintTransformer(
                GradientPaintTransformType.CENTER_VERTICAL));
        assertTrue(b1.equals(b2));
       
        // check an inherited attribute
        b1.setVisible(false);
        assertFalse(b1.equals(b2));
        b2.setVisible(false);
        assertTrue(b1.equals(b2));
       
    }
View Full Code Here

    /**
     * Two objects that are equal are required to return the same hashCode.
     */
    public void testHashCode() {
        DialBackground b1 = new DialBackground(Color.red);
        DialBackground b2 = new DialBackground(Color.red);
        assertTrue(b1.equals(b2));
        int h1 = b1.hashCode();
        int h2 = b2.hashCode();
        assertEquals(h1, h2);
    }
View Full Code Here

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        // test default instance
        DialBackground b1 = new DialBackground();
        DialBackground b2 = null;
        try {
            b2 = (DialBackground) b1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(b1 != b2);
        assertTrue(b1.getClass() == b2.getClass());
        assertTrue(b1.equals(b2));
       
        // test a customised instance
        b1 = new DialBackground();
        b1.setPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f,
                Color.green));
        b1.setGradientPaintTransformer(new StandardGradientPaintTransformer(
                GradientPaintTransformType.CENTER_VERTICAL));
        b2 = null;
        try {
            b2 = (DialBackground) b1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(b1 != b2);
        assertTrue(b1.getClass() == b2.getClass());
        assertTrue(b1.equals(b2));
       
        // check that the listener lists are independent
        MyDialLayerChangeListener l1 = new MyDialLayerChangeListener();
        b1.addChangeListener(l1);
        assertTrue(b1.hasListener(l1));
        assertFalse(b2.hasListener(l1));
    }
View Full Code Here

TOP

Related Classes of org.jfree.chart.plot.dial.DialBackground

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.