2020国产成人精品视频,性做久久久久久久久,亚洲国产成人久久综合一区,亚洲影院天堂中文av色

分享

JFreeChart實(shí)時(shí)曲線(絕對一手資料,本例子我應(yīng)用與多個(gè)實(shí)際項(xiàng)目中,與JMS技術(shù)結(jié)合)

 wuxyu 2007-12-12
package com.cityinforport.demo;
/**
 * =============================================================
 * JFreeChart開發(fā):利用JFreeChart開發(fā)實(shí)時(shí)曲線
 * =============================================================
 * Description:該例子演示了單條曲線的簡單使用方法
 * Original Author:謝莫鋒  QQ:35814522 EMAIL:xmf3000@126.com created by 2005-02-28
 *
 * Changes:
 * -------------------------------------------------------------
 * 2005-03-01 增加線程調(diào)用 by xmf
 * 2005-03-02 界面調(diào)整 by xmf
 * -------------------------------------------------------------
 */

//導(dǎo)入java2d包
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.io.PrintStream;
//導(dǎo)入jfreechart包(chart)
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.plot.XYPlot;
//導(dǎo)入jfreechart包(data)
import org.jfree.data.time.*;
import org.jfree.data.xy.XYDataset;
//導(dǎo)入jfreechart包(ui)
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;

public class TimeSeriesDemo1 extends JFrame implements Runnable,ActionListener{
  //時(shí)序圖數(shù)據(jù)集
  private TimeSeries timeseries;
  //Value坐標(biāo)軸初始值
  private double lastValue;
  static Class class$org$jfree$data$time$Millisecond;
  static Thread thread1;

  public static void main(String[] args){
    TimeSeriesDemo1 TimeSeriesDemo1 = new TimeSeriesDemo1();
    TimeSeriesDemo1.pack();
    RefineryUtilities.centerFrameOnScreen(TimeSeriesDemo1);
    TimeSeriesDemo1.setVisible(true);
    startThread();
  }

  public void run(){
    while(true){
      try{
    //根據(jù)實(shí)際需要在此處加入需要執(zhí)行的代碼
    double d = 0.9D + 0.2D * Math.random();
    lastValue = lastValue * d;
    Millisecond millisecond = new Millisecond();
    System.out.println("Now=" + millisecond.toString());
    timeseries.add(millisecond, lastValue);
    Thread.sleep(300);
      }catch(InterruptedException e){}
    }
  }

  public static void startThread(){
    thread1.start();
  }

  public void actionPerformed(ActionEvent e){
    if(e.getActionCommand().equals("EXIT")){
      thread1.destroy();
      System.exit(0);
    }
  }


  public TimeSeriesDemo1(){
    //super(new BorderLayout());
    thread1 = new Thread(this);
    lastValue = 100D;
    //創(chuàng)建時(shí)序圖對象
    timeseries = new TimeSeries("Random Data",TimeSeriesDemo1.class$org$jfree$data$time$Millisecond != null ? TimeSeriesDemo1.class$org$jfree$data$time$Millisecond : (TimeSeriesDemo1.class$org$jfree$data$time$Millisecond = TimeSeriesDemo1.getClass("org.jfree.data.time.Millisecond")));
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timeseries);
    //創(chuàng)建圖表面板
    ChartPanel chartpanel = new ChartPanel(createChart(timeseriescollection));
    chartpanel.setPreferredSize(new Dimension(500,270));

    JPanel jpanel = new JPanel();
    jpanel.setBorder(BorderFactory.createEmptyBorder(4,4,4,4));//邊距為4
    JButton jbutton = new JButton("退出");
    jbutton.setActionCommand("EXIT");
    jbutton.addActionListener(this);
    jpanel.add(jbutton);

    getContentPane().add(chartpanel);
    getContentPane().add(jpanel,"South");
  }

  private JFreeChart createChart(XYDataset xydataset){
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("時(shí)序圖例子","時(shí)間","溫度值",xydataset,true,true,false);
    XYPlot xyplot = jfreechart.getXYPlot();
    //縱坐標(biāo)設(shè)定
    ValueAxis valueaxis = xyplot.getDomainAxis();
    valueaxis.setAutoRange(true);
    valueaxis.setFixedAutoRange(60000D);

    valueaxis = xyplot.getRangeAxis();
    valueaxis.setRange(0.0D,200D);

    return jfreechart;
  }

  static Class getClass(String s){
    Class cls = null;
    try{
      cls = Class.forName(s);
    }catch(ClassNotFoundException cnfe){
      throw new NoClassDefFoundError(cnfe.getMessage());
    }
    return cls;
  }

}


===============================================
package com.cityinforport.demo;
/**
 * =============================================================
 * JFreeChart開發(fā):利用JFreeChart開發(fā)實(shí)時(shí)曲線
 * =============================================================
 * Description:該例子演示了多條曲線的簡單使用方法
 * Original Author:xmf created by 2005-03-03
 *
 * Changes:
 * -------------------------------------------------------------
 * 在此處注明修改日期、修改點(diǎn)、修改人
 * -------------------------------------------------------------
 */

//導(dǎo)入java2d包
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.io.PrintStream;
//導(dǎo)入jfreechart包(chart)
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.DefaultXYItemRenderer;
//導(dǎo)入jfreechart包(data)
import org.jfree.data.time.*;
import org.jfree.data.xy.XYDataset;
//導(dǎo)入jfreechart包(ui)
import org.jfree.ui.*;

public class TimeSeriesDemo2 extends JFrame implements Runnable,ActionListener{

  //申明實(shí)時(shí)曲線對象
  private TimeSeries timeseries1;
  private TimeSeries timeseries2;

  //Value坐標(biāo)軸初始值
  private double lastValue1,lastValue2;
  private double originalValue1,originalValue2;

  static Class class$org$jfree$data$time$Millisecond;
  static Thread thread1;

  public static void main(String[] args){
    TimeSeriesDemo2 TimeSeriesDemo2 = new TimeSeriesDemo2();
    TimeSeriesDemo2.pack();
    RefineryUtilities.centerFrameOnScreen(TimeSeriesDemo2);
    TimeSeriesDemo2.setVisible(true);
    startThread();
  }

  public void run(){
    while(true){
      try{
    //說明:在此處添加具體的業(yè)務(wù)數(shù)據(jù)

    //隨機(jī)產(chǎn)生曲線1的數(shù)據(jù)
    double d1 = 2.0D * Math.random();
    lastValue1 = originalValue1 * d1;
    Millisecond millisecond1 = new Millisecond();
    System.out.println("Series1 Now=" + millisecond1.toString());
    timeseries1.add(millisecond1, lastValue1);
    //隨機(jī)產(chǎn)生曲線2的數(shù)據(jù)
    double d2 = 2.0D * Math.random();
    lastValue2 = originalValue2 * d2;
    Millisecond millisecond2 = new Millisecond();
    System.out.println("Series2 Now=" + millisecond2.toString());
    timeseries2.add(millisecond2,lastValue2);

    Thread.sleep(500);
      }catch(InterruptedException e){}
    }
  }

  public static void startThread(){
    thread1.start();
  }

  public void actionPerformed(ActionEvent e){
    if(e.getActionCommand().equals("EXIT")){
      thread1.interrupt();
      System.exit(0);
    }
  }


  public TimeSeriesDemo2(){
    thread1 = new Thread(this);
    originalValue1 = 100D;
    originalValue2 = 100D;
    //創(chuàng)建時(shí)序圖對象
    timeseries1 = new TimeSeries("熱風(fēng)溫1",TimeSeriesDemo2.class$org$jfree$data$time$Millisecond != null ? TimeSeriesDemo2.class$org$jfree$data$time$Millisecond : (TimeSeriesDemo2.class$org$jfree$data$time$Millisecond = TimeSeriesDemo2.getClass("org.jfree.data.time.Millisecond")));
    timeseries2 = new TimeSeries("熱風(fēng)溫2",TimeSeriesDemo2.class$org$jfree$data$time$Millisecond != null ? TimeSeriesDemo2.class$org$jfree$data$time$Millisecond : (TimeSeriesDemo2.class$org$jfree$data$time$Millisecond = TimeSeriesDemo2.getClass("org.jfree.data.time.Millisecond")));
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection(timeseries1);
    TimeSeriesCollection timeseriescollection1 = new TimeSeriesCollection(timeseries2);

    //創(chuàng)建jfreechart對象
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("RTU溫度模擬量實(shí)時(shí)曲線圖","Time","Value",
                            timeseriescollection,true,true,false);
    jfreechart.setBackgroundPaint(Color.white);

    //設(shè)定顯示風(fēng)格
    XYPlot xyplot = jfreechart.getXYPlot();
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new Spacer(1, 4D, 4D, 4D, 4D));
    ValueAxis valueaxis = xyplot.getDomainAxis();
    valueaxis.setAutoRange(true);
    valueaxis.setFixedAutoRange(60000D);
    //設(shè)定Value的范圍
    valueaxis = xyplot.getRangeAxis();
    valueaxis.setRange(0.0D,200D);
    xyplot.setDataset(1, timeseriescollection1);
    xyplot.setRenderer(1,new DefaultXYItemRenderer());

    //創(chuàng)建圖表面板
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    getContentPane().add(chartpanel);

    //根據(jù)需要添加操作按鈕
    this.setTitle("RTU實(shí)時(shí)曲線");
    JPanel jpanel = new JPanel();
    jpanel.setBorder(BorderFactory.createEmptyBorder(4,4,4,4));//邊距為4
    JButton jbutton = new JButton("退出");
    jbutton.setActionCommand("EXIT");
    jbutton.addActionListener(this);
    jpanel.add(jbutton);
    getContentPane().add(jpanel,"South");
    chartpanel.setPreferredSize(new Dimension(500,270));
  }

  static Class getClass(String s){
    Class cls = null;
    try{
      cls = Class.forName(s);
    }catch(ClassNotFoundException cnfe){
      throw new NoClassDefFoundError(cnfe.getMessage());
    }
    return cls;
  }

}

    本站是提供個(gè)人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多