Example usage for org.jfree.chart.plot.dial DialPointer.Pointer DialPointer.Pointer

List of usage examples for org.jfree.chart.plot.dial DialPointer.Pointer DialPointer.Pointer

Introduction

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

Prototype

DialPointer.Pointer

Source Link

Usage

From source file:ecg.ecgshow.ECGShowUI.java

private void createGuardData() {
    GuardDataPanel = new JPanel();
    GuardDataPanel.setBackground(new Color(0, 150, 255));
    //        GuardDataPanel.setBounds();
    //        BoxLayout layout=new BoxLayout(GuardDataPanel,BoxLayout.Y_AXIS);
    //        GuardDataPanel.setLayout(layout);
    GroupLayout layout = new GroupLayout(GuardDataPanel);
    GuardDataPanel.setLayout(layout);//from   w  w w .j  a  v a2s . c  o  m
    JPanel temperatureData = new JPanel();
    temperatureData.setLayout(new FlowLayout());
    //        temperatureData.setLayout(null);
    //        temperatureData.setBounds(0,0,(int) (WIDTH * 0.14), (int) (HEIGHT * 0.15));
    temperatureData.setSize((int) (WIDTH * 0.16), (int) (HEIGHT * 0.11));
    temperatureData.setBackground(new Color(0, 150, 255));
    temperatureLabel = new JLabel("--.- ");
    temperatureLabel.setFont(loadFont("LED.tff", (float) (HEIGHT * 0.070)));
    temperatureLabel.setBackground(new Color(0, 150, 255));
    temperatureLabel.setForeground(Color.RED);
    //        temperatureLabel.setBounds(0,0,200,100);
    temperatureLabel.setOpaque(true);
    JLabel temperatureLabelName = new JLabel(" ");
    temperatureLabelName.setFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.020)));
    temperatureLabelName.setBackground(new Color(0, 150, 255));
    temperatureLabelName.setForeground(Color.BLACK);
    temperatureLabelName.setBounds(0, 0, 100, 100);
    temperatureLabelName.setOpaque(true); //??
    temperatureData.add(temperatureLabelName);
    temperatureData.add(temperatureLabel);
    //        JPanel emptyPanel=new JPanel();
    //        emptyPanel.setSize((int)(WIDTH*0.14),(int)(HEIGHT*0.2));
    //        emptyPanel.setBackground(new Color(0,150,255));
    //        GuardDataPanel.add(emptyPanel);

    JPanel lightValueData = new JPanel();
    lightValueData.setLayout(new BorderLayout());
    lightValueData.setBackground(new Color(0, 150, 255));
    //        lightValueData.setBounds(0,(int)(HEIGHT*0.28),(int)(WIDTH*0.14),(int)(HEIGHT*0.30));
    lightValueData.setSize((int) (WIDTH * 0.14), (int) (HEIGHT * 0.22));
    lightValueDataSet = new DefaultValueDataset();
    DialPlot lightValueDialPlot = new DialPlot();
    lightValueDialPlot.setDataset(lightValueDataSet);
    StandardDialFrame dialFrame = new StandardDialFrame();
    dialFrame.setVisible(false);
    lightValueDialPlot.setDialFrame(dialFrame);

    GradientPaint gradientpaint = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(),
            new Color(170, 170, 170));
    DialBackground dialBackground = new DialBackground(gradientpaint);
    dialBackground.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
    lightValueDialPlot.setBackground(dialBackground);
    // ??
    DialTextAnnotation dialtextannotation = new DialTextAnnotation("");
    dialtextannotation.setFont(new Font("Dialog", 0, (int) (0.016 * HEIGHT)));
    dialtextannotation.setRadius(0.1D);
    lightValueDialPlot.addLayer(dialtextannotation);

    DialValueIndicator dialValueIndicator = new DialValueIndicator(0);
    dialValueIndicator.setFont(new Font("Dialog", Font.PLAIN, (int) (0.011 * HEIGHT)));
    dialValueIndicator.setOutlinePaint(Color.darkGray);
    dialValueIndicator.setRadius(0.4D);
    dialValueIndicator.setAngle(-90.0);
    lightValueDialPlot.addLayer(dialValueIndicator);

    StandardDialScale dialScale = new StandardDialScale();
    dialScale.setLowerBound(0D); // 
    dialScale.setUpperBound(1024); // 
    dialScale.setMajorTickIncrement(100);
    dialScale.setStartAngle(-120D); // 120,?
    dialScale.setExtent(-300D); // 300,?
    dialScale.setTickRadius(0.85D); // ,
    dialScale.setTickLabelOffset(0.1D); // ,0

    bloodDialRange = new StandardDialRange(500D, 750D, Color.red);
    bloodDialRange.setInnerRadius(0.52000000000000002D);
    bloodDialRange.setOuterRadius(0.55000000000000004D);
    lightValueDialPlot.addLayer(bloodDialRange);
    //
    bubbleDialRange = new StandardDialRange(0D, 500D, Color.black);
    bubbleDialRange.setInnerRadius(0.52000000000000002D);
    bubbleDialRange.setOuterRadius(0.55000000000000004D);
    lightValueDialPlot.addLayer(bubbleDialRange);
    //
    normalDialRange = new StandardDialRange(750D, 1024D, Color.green);
    normalDialRange.setInnerRadius(0.52000000000000002D);
    normalDialRange.setOuterRadius(0.55000000000000004D);
    lightValueDialPlot.addLayer(normalDialRange);

    dialScale.setTickLabelFont(new Font("Dialog", 0, (int) (0.011 * HEIGHT))); // 
    lightValueDialPlot.addScale(0, dialScale);

    DialPointer.Pointer pointer = new DialPointer.Pointer();
    lightValueDialPlot.addPointer(pointer);
    lightValueDialPlot.mapDatasetToScale(0, 0);
    DialCap dialCap = new DialCap();
    dialCap.setRadius(0.07D);
    JFreeChart lightValueDialChart = new JFreeChart(lightValueDialPlot);
    lightValueDialChart.setBackgroundPaint(new Color(0, 150, 255));
    lightValueDialChart.setTitle("??");
    lightValueDialChart.getTitle().setFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.020)));
    ChartPanel lightValueDialChartPanel = new ChartPanel(lightValueDialChart, (int) (WIDTH * 0.15),
            (int) (HEIGHT * 0.27), 0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE, true, true, false, true, false,
            false);
    lightValueData.add(lightValueDialChartPanel, BorderLayout.CENTER);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                            .addComponent(temperatureData, GroupLayout.Alignment.LEADING)
                            .addComponent(lightValueData, GroupLayout.Alignment.LEADING))));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addGap((int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05))
                    .addComponent(temperatureData)
                    .addGap((int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05))
                    .addComponent(lightValueData)
                    .addGap((int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05))));

    //        JPanel alarmMessage=new JPanel();
    //        alarmMessage.setBackground(new Color(0,150,255));
    //        alarmMessLabel=new JLabel("");
    //        alarmMessLabel.setFont(new Font("SansSerif", 0, (int)(HEIGHT *0.020)));
    //        alarmMessLabel.setBackground(new Color(0,150,255));
    //        alarmMessage.add(alarmMessLabel);
    //        GuardDataPanel.add(alarmMessage);
}