Example usage for org.jfree.chart.plot.dial StandardDialScale setVisible

List of usage examples for org.jfree.chart.plot.dial StandardDialScale setVisible

Introduction

In this page you can find the example usage for org.jfree.chart.plot.dial StandardDialScale setVisible.

Prototype

public void setVisible(boolean visible) 

Source Link

Document

Sets the flag that determines whether or not this layer is drawn by the plot, and sends a DialLayerChangeEvent to all registered listeners.

Usage

From source file:it.alus.GPSreceiver.instruments.Variometer.java

public Variometer() {
    super(null);/*from w  w  w.  j av  a2s  . co m*/
    dataset = new DefaultValueDataset(0.0);
    DialPlot plot = new DialPlot();
    plot.setView(0.0, 0.0, 1.0, 1.0);
    plot.setDataset(0, dataset);
    StandardDialFrame dialFrame = new StandardDialFrame();
    dialFrame.setBackgroundPaint(Color.lightGray);
    dialFrame.setForegroundPaint(Color.gray);
    DialTextAnnotation titleLabel = new DialTextAnnotation("Vertical speed");
    titleLabel.setFont(new Font("Arial", 1, 18));
    titleLabel.setRadius(0.45D);
    titleLabel.setAngle(90);
    titleLabel.setPaint(Color.lightGray);
    plot.addLayer(titleLabel);
    DialTextAnnotation unitLabel = new DialTextAnnotation("100 Ft/min");
    unitLabel.setFont(new Font("Arial", 1, 18));
    unitLabel.setRadius(0.3D);
    unitLabel.setAngle(90);
    unitLabel.setPaint(Color.white);
    plot.addLayer(unitLabel);
    DialValueIndicator valueindicator = new DialValueIndicator(0);
    plot.addLayer(valueindicator);
    DialTextAnnotation annotation = new DialTextAnnotation("Ft/min");
    annotation.setFont(new Font("Arial", 1, 14));
    annotation.setRadius(0.4D);
    annotation.setPaint(Color.lightGray);
    plot.addLayer(annotation);
    plot.setDialFrame(dialFrame);
    StandardDialScale realScale = new StandardDialScale(-3000, 3000, -10, -340, 100, 10);
    realScale.setVisible(false);
    plot.addScale(0, realScale);
    StandardDialScale dispScale = new StandardDialScale(-30, 30, -10, -340, 5, 10);
    dispScale.setMajorTickPaint(Color.white);
    dispScale.setMinorTickPaint(Color.lightGray);
    dispScale.setFirstTickLabelVisible(true);
    dispScale.setTickRadius(0.88);
    dispScale.setTickLabelOffset(0.15);
    NumberFormat formatter = new DecimalFormat("#");
    dispScale.setTickLabelFormatter(formatter);
    dispScale.setTickLabelFont(new Font("Arial", Font.BOLD, 24));
    dispScale.setTickLabelPaint(Color.white);
    plot.addScale(1, dispScale);
    plot.setBackground(new DialBackground(Color.black));
    Pointer needle = new Pointer(0);
    needle.setFillPaint(Color.white);
    plot.addLayer(needle);
    plot.mapDatasetToScale(1, 1);
    DialCap cap = new DialCap();
    cap.setRadius(0.10);
    cap.setFillPaint(Color.gray);
    plot.setCap(cap);
    jChart = new JFreeChart(plot);
    super.setChart(jChart);
    super.setPreferredSize(new Dimension(400, 400));
}

From source file:it.alus.GPSreceiver.instruments.Altimeter.java

public Altimeter(float groundAltitudeFt) {
    super(null);// ww w .j a va2 s.  c o  m
    altitude = 0;
    if (groundAltitudeFt < 0)
        groundAltitude = 0;
    else
        groundAltitude = groundAltitudeFt;
    hoursDataset = new DefaultValueDataset(0.0);
    minutesDataset = new DefaultValueDataset(0.0);
    DialPlot plot = new DialPlot();
    plot.setView(0.0, 0.0, 1.0, 1.0);
    Image background = Toolkit.getDefaultToolkit().getImage(getClass().getResource("altimeter.png"));
    plot.setDataset(0, hoursDataset);
    plot.setDataset(1, minutesDataset);
    StandardDialFrame dialFrame = new StandardDialFrame();
    dialFrame.setBackgroundPaint(Color.lightGray);
    dialFrame.setForegroundPaint(Color.gray);
    DialTextAnnotation annotation = new DialTextAnnotation("Feet");
    annotation.setFont(new Font("Arial", 1, 14));
    annotation.setRadius(0.4D);
    annotation.setPaint(Color.lightGray);
    plot.addLayer(annotation);
    DialValueIndicator valueindicator = new DialValueIndicator(0);
    NumberFormat formatter = new DecimalFormat("#");
    plot.addLayer(valueindicator);
    plot.setDialFrame(dialFrame);
    StandardDialScale scale = new StandardDialScale(0, 10, 90, -360, 1, 10);
    scale.setMajorTickPaint(Color.white);
    scale.setMinorTickPaint(Color.lightGray);
    scale.setFirstTickLabelVisible(false);
    scale.setTickRadius(0.88);
    scale.setTickLabelOffset(0.15);
    scale.setTickLabelFormatter(formatter);
    scale.setTickLabelFont(new Font("Arial", Font.BOLD, 24));
    scale.setTickLabelPaint(Color.white);
    plot.addScale(3, scale);
    plot.setBackground(new DialBackground(Color.black));
    StandardDialScale hourScale = new StandardDialScale(0, 10000, 90, -360, 1000, 10);
    hourScale.setVisible(false);
    hourScale.setTickRadius(0.88);
    hourScale.setTickLabelOffset(0.15);
    plot.addScale(0, hourScale);
    StandardDialScale minScale = new StandardDialScale(0, 1000, 90, -360, 0, 0);
    minScale.setVisible(false);
    minScale.setMajorTickIncrement(5.0);
    minScale.setTickRadius(0.68);
    plot.addScale(1, minScale);
    Pointer hourNeedle = new Pointer(0);
    hourNeedle.setRadius(0.55);
    hourNeedle.setFillPaint(Color.lightGray);
    plot.addLayer(hourNeedle);
    plot.mapDatasetToScale(1, 1);
    Pointer minNeedle = new Pointer(1);
    minNeedle.setFillPaint(Color.white);
    plot.addLayer(minNeedle);
    DialCap cap = new DialCap();
    cap.setRadius(0.10);
    cap.setFillPaint(Color.lightGray);
    plot.setCap(cap);
    jChart = new JFreeChart(plot);
    jChart.setBackgroundImage(background);
    super.setChart(jChart);
    super.setPreferredSize(new Dimension(400, 400));
}