Evalution Time

Soll eine Summe über eine Variable ausgegeben werden, muss eine Variable erstellt werden. Der Reset Type der Variable muss Report sein, um die Summe des Wertes aus jedem gelieferten Datensatz zu erhalten.Das Ausgabefeld des Image muss den Wert Evaluation Time  = Report haben. Da der Wert der Variable erst nach der vollständigen Berechnung an die Generierung des Images übergeben werden soll.

Dieser Java -Code wurde aus der Vorlage DialDemo2.java entnommen und entsprechend modifiziert.

package org.axismanipulation;
import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.Font;
import java.math.BigDecimal;
import java.text.NumberFormat;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.dial.*;
import org.jfree.data.general.DefaultValueDataset;
import org.jfree.ui.GradientPaintTransformType;
import org.jfree.ui.RectangleInsets;
import org.jfree.ui.StandardGradientPaintTransformer;
import org.jfree.ui.TextAnchor;
 
 public class TachoPlotEinfach {
     static DefaultValueDataset dataset1 = new DefaultValueDataset(10D);
         
         
        static public BufferedImage getTachoMeterEinfach(int erster, String labelo, String labelu ){
            NumberFormat nb = NumberFormat.getIntegerInstance();
             
            String labelEinheit = labelu;
      
            BufferedImage image = new BufferedImage(250,250,BufferedImage.TYPE_4BYTE_ABGR);
            dataset1.setValue(new Integer(erster));
             
            DialPlot dialplot = new DialPlot();
            dialplot.setView(0.0D, 0.0D, 1.0D, 1.0D);
            dialplot.setDataset(0, dataset1);
            
            StandardDialFrame standarddialframe = new StandardDialFrame();
            standarddialframe.setBackgroundPaint(Color.lightGray);
            standarddialframe.setForegroundPaint(Color.darkGray);
            dialplot.setDialFrame(standarddialframe);
            GradientPaint gradientpaint = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), new Color(170, 170, 220));
            DialBackground dialbackground = new DialBackground(gradientpaint);
            dialbackground.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
            dialplot.setBackground(dialbackground);
            DialTextAnnotation dialtextannotation = new DialTextAnnotation(labelEinheit);
            dialtextannotation.setFont(new Font("Dialog", 1, 8));
            dialtextannotation.setRadius(0.73D);
            dialtextannotation.setAnchor(TextAnchor.TOP_CENTER);
            DialTextAnnotation dialtextannotation1 = new DialTextAnnotation(labelo);
            dialtextannotation1.setFont(new Font("Dialog", 1, 8));
            dialtextannotation1.setRadius(0.65D);
            dialtextannotation1.setAnchor(TextAnchor.TOP_CENTER);
            dialplot.addLayer(dialtextannotation);
            dialplot.addLayer(dialtextannotation1);
            DialValueIndicator dialvalueindicator = new DialValueIndicator(0);
            //Größe des Rechteckes
            dialvalueindicator.setInsets(new RectangleInsets(6, 8, 6, 8));
            dialvalueindicator.setFont(new Font("Calibri",Font.TRUETYPE_FONT, 8));
            dialvalueindicator.setOutlinePaint(Color.BLUE);
            dialvalueindicator.setRadius(0.39999999999999998D);
            dialvalueindicator.setAngle(-90D);
            dialvalueindicator.setNumberFormat(nb);
            dialplot.addLayer(dialvalueindicator);
             
            StandardDialScale standarddialscale = new StandardDialScale(0.0D, 100D, -120D, -300D, 10D, 4);
            standarddialscale.setTickRadius(0.88D);
            standarddialscale.setTickLabelOffset(0.14999999999999999D);
            standarddialscale.setTickLabelFont(new Font("Calibri", 0, 14));
            standarddialscale.setTickLabelFormatter(nb);
            dialplot.addScale(0, standarddialscale);
            
            StandardDialRange standarddialrange = new StandardDialRange(80D, 100D, Color.blue);
            standarddialrange.setScaleIndex(0);
            standarddialrange.setInnerRadius(0.58999999999999997D);
            standarddialrange.setOuterRadius(0.58999999999999997D);
            dialplot.addLayer(standarddialrange);
            org.jfree.chart.plot.dial.DialPointer.Pin pin = new org.jfree.chart.plot.dial.DialPointer.Pin(1);
            pin.setRadius(0.55000000000000004D);
            dialplot.addPointer(pin);
            org.jfree.chart.plot.dial.DialPointer.Pointer pointer = new org.jfree.chart.plot.dial.DialPointer.Pointer(0);
            dialplot.addPointer(pointer);
            DialCap dialcap = new DialCap();
            dialcap.setRadius(0.10000000000000001D);
            dialplot.setCap(dialcap);
            JFreeChart jfreechart = new JFreeChart(dialplot);
             
            Graphics2D g2 = image.createGraphics();
            jfreechart.draw(g2, new Rectangle2D.Double(0.0, 0.0, 250, 250));
            g2.dispose();
          return image;
        }
     
}

Formatierungen Label

Das Label unterstützt keinerlei Textumbruch, jedenfalls nicht die gängigen "\n". Daher wird hie auf ein zweites Label zurückgegeriffen.

Formatierungen Textbox

  • Keine Stichwörter