⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 castcurve.java

📁 用于显示适时的曲线图
💻 JAVA
字号:
//<applet code=CastCurve width=300 height=150>
//<param name=winsize value="650,450">
//<param name=Title value="甲班1#机 1_23456 中包温度 (2003-9-10 12:34:55)">
//<param name=ValueY value="1510,1524,1521,1522,1516,1516,1525,1510,1525,1526,1524,1511,1518,1527,1526,1517,1529,1527,1511,1529,1517,1520,1525,1511,1522,1519,1516,1522,1523,1515,1516,1527,1526,1522,1530,1528,1515,1524,1530,1515,1521,1512,1530,1524,1510,1522,1512,1512,1526,1516,1511,1516,1518,1516,1529,1530,1518,1516,1513,1513,1523,1518,1518,1524,1517,1523,1514,1514,1522,1512,1519,1528,1515,1526,1518,1516,1528,1523,1523,1519,1512,1521,1524,1528,1527,1510,1521,1528,1519,1524,1520,1520,1519,1517,1518,1515,1511,1515,1530,1511,1518,1517,1520,1513,1519,1515,1523,1521,1513,1529,1523,1520,1518,1512,1526,1519,1525,1522,1527,1510,1514,1511,1512,1517,1513,1510,1521,1523,1521,1527,1512,1514,1524,1519,1517,1513,1524,1529,1521,1512,1525,1518,1519,1520,1514,1517,1512,1522,1513,1529,1512,1519,1515,1527,1525,1515,1523,1515,1512,1511,1516,1526,1516,1515,1520,1515,1517,1511,1520,1514,1527,1522,1525,1529,1517,1521,1512,1523,1518,1529,1512,1528,1522,1517,1513,1520,1514,1530,1513,1511,1517,1521,1528,1521,1518,1527,1527,1523,1524,1530,1517,1520,1518,1524,1514,1518,1521,1526,1521,1519,1520,1515,1522,1520,1524,1528,1517,1516,1516,1513,1521,1514,1522,1517,1528,1520,1514,1524,1525,1522,1526,1513,1526,1514,1529,1511,1511,1526,1518,1519,1512,1512,1513,1511,1524,1521,1521,1514,1519,1525,1525,1518,1528,1525,1512,1523,1524,1510,1519,1518,1516,1530,1526,1524,1518,1525,1516,1517,1519,1529,1512,1523,1517,1512,1514,1512,1519,1529,1521,1520,1529,1514,1518,1518,1516,1520,1513,1520,1529,1521,1528,1523,1519,1524,1511,1525,1524,1520,1513,1514,1517,1526,1511,1520,1525,1526,1517,1529,1526,1523,1528,1528,1518,1512,1529,1526,1524,1518,1510,1513,1513,1520,1518,1512,1516,1523,1527,1520,1514,1528,1517,1516,1525,1514,1519,1515,1528,1522,1517,1518,1527,1522,1529,1520,1517,1527,1515,1515,1514,1517,1510,1525,1527,1516,1524,1518,1526,1525,1519,1512,1518,1517,1524,1516,1526,1513,1522,1529,1515,1529,1512,1530,1523,1522,1528,1521,1515,1527,1511,1519,1525,1515,1518,1518,1521,1515,1522,1514,1512,1528,1512,1523,1528,1515,1529,1527,1519,1520,1525,1527,1518,1514 ">
//<param name=ValueX value="0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,258,261,264,267,270,273,276,279,282,285,288,291,294,297,300,303,306,309,312,315,318,321,324,327,330,333,336,339,342,345,348,351,354,357,360,363,366,369,372,375,378,381,384,387,390,393,396,399,402,405,408,411,414,417,420,423,426,429,432,435,438,441,444,447,450,453,456,459,462,465,468,471,474,477,480,483,486,489,492,495,498,501,504,507,510,513,516,519,522,525,528,531,534,537,540,543,546,549,552,555,558,561,564,567,570,573,576,579,582,585,588,591,594,597,600,603,606,609,612,615,618,621,624,627,630,633,636,639,642,645,648,651,654,657,660,663,666,669,672,675,678,681,684,687,690,693,696,699,702,705,708,711,714,717,720,723,726,729,732,735,738,741,744,747,750,753,756,759,762,765,768,771,774,777,780,783,786,789,792,795,798,801,804,807,810,813,816,819,822,825,828,831,834,837,840,843,846,849,852,855,858,861,864,867,870,873,876,879,882,885,888,891,894,897,900,903,906,909,912,915,918,921,924,927,930,933,936,939,942,945,948,951,954,957,960,963,966,969,972,975,978,981,984,987,990,993,996,999,1002,1005,1008,1011,1014,1017,1020,1023,1026,1029,1032,1035,1038,1041,1044,1047,1050,1053,1056,1059,1062,1065,1068,1071,1074,1077,1080,1083,1086,1089,1092,1095,1098,1101,1104,1107,1110,1113,1116,1119,1122,1125,1128,1131,1134,1137,1140,1143,1146,1149,1152,1155,1158,1161,1164,1167,1170,1173,1176,1179,1182,1185,1188,1191,1194,1197,1200,1203 ">
//</applet>

import java.awt.*;
import java.applet.*;
import java.util.*;

public class  CastCurve extends Applet
{
	CurveChart Chart;
	Color TitleColor = Color.red;
	String Title = new String("");
	String LeftTitle = new String("");
	String LeftFormat = new String("");
	String BottomTitle = new String("");
	int LeftType = 1;
	float LeftMax =100;
	float LeftMin = 0;
	float BottomMax =1000;
	float BottomMin = 0;
	int Width =520;
	int Height =400;
	int si = 1;
	String vx=new String("");
	String vy=new String("");
	public void setLeftTitle(String s)
	{
	   LeftTitle = s;
	}
	public void setTitle(String s)
	{
	   Title = s;
	}
	public void setLeftFormat(String s)
	{
	   LeftFormat = s;
	}
	public void setLeftMaxMin(String max, String min)
	{
	   LeftMax = (new Float(max)).floatValue();
	   LeftMin = (new Float(min)).floatValue();
	}
	/*public void setLeftMaxMin(float max, float min)
	{
	   LeftMax = max;
	   LeftMin = min;
	} 
	public void setBottomMaxMin(float max, float min)
	{
	   BottomMax = max;
	   BottomMin = min;
	} */
	public void setBottomMaxMin(String max, String min)
	{
	   BottomMax = (new Float(max)).floatValue();
	   BottomMin = (new Float(min)).floatValue();
	}
	
	public String getParameter(String get, String def)
	{
		return getParameter(get)!=null?getParameter(get):def;
	}
	public void init()
	{
		Chart = new CurveChart(this,new Point(0,0),new Point(Width,Height));
		Chart.setAxisVisible(true,true,false,false);
		Title = getParameter("Title","中包温度曲线图");
		LeftMax = 1600;
		LeftMin = 1500;
		BottomMax=1000;
		LeftTitle = getParameter("LeftTitle","℃");
		BottomTitle = getParameter("BottomTitle","分'秒");
		LeftFormat = getParameter("LeftFormat","n.0");
	}
	Color getColor(String c)
	{
		if(c.compareTo("black")==0)		return Color.black;
		if(c.compareTo("red")==0)		return Color.red;
		if(c.compareTo("blue")==0)		return Color.blue;
		if(c.compareTo("cyan")==0)		return Color.cyan;
		if(c.compareTo("darkGray")==0)		return Color.darkGray;
		if(c.compareTo("gray")==0)		return Color.gray;
		if(c.compareTo("green")==0)		return Color.green;
		if(c.compareTo("lightGray")==0)		return Color.lightGray;
		if(c.compareTo("magenta")==0)		return Color.magenta;
		if(c.compareTo("orange")==0)		return Color.orange;
		if(c.compareTo("pink")==0)		return Color.pink;
		if(c.compareTo("white")==0)		return Color.white;
		if(c.compareTo("yellow")==0)		return Color.yellow;
		return Color.black;
	}
	Color getColor(int r, int g, int b)
	{
		return new  Color(r, g, b);
	}
	public void addSeries(String Title,String c,String vx,String vy)
	{
		Chart.addSeries();
		Chart.getSeries(Chart.getSeriesCount()-1).setTitle(Title);
		Chart.getSeries(Chart.getSeriesCount()-1).setColor(getColor(c));
		getValue(Chart.getSeriesCount()-1,vx, vy);
		
	}
	/*public void addSeries(String Title,int r, int g, int b,String vx,String vy)
	{
		Chart.addSeries();
		Chart.getSeries(Chart.getSeriesCount()-1).setTitle(Title);
		Chart.getSeries(Chart.getSeriesCount()-1).setColor(getColor(r,g,b));
		getValue(Chart.getSeriesCount()-1,vx, vy);
	}	 */ 
	public void clear()
	{
		Chart.clearSeries();
	}
	void setChart()
	{
		try
		{
			Chart.Left.setFormat(LeftFormat);
			Chart.Left.setTitle(LeftTitle);
			Chart.Left.setMaxMin(LeftMax, LeftMin);
			Chart.Bottom.setMaxMin(BottomMax, BottomMin);
			Chart.Bottom.setTitle(BottomTitle);
			Chart.Bottom.setTextType(4);
			Chart.setTitle(Title);
				
		}
		catch(Exception e)
		{
			System.out.println(e);
		}
	}
	void getValue(int si,String vx,String vy)
	{
		Vector x = new Vector();
		Vector y = new Vector();
		int i;
		int last_i;
		String s = vx;
		if(s.length()==0) return;
		for(i=0,last_i=0;i<s.length(); i++)
		{
			if(s.charAt(i)==',')
			{
				x.addElement(new Float(s.substring(last_i, i)));
				last_i = i+1;
			}
		}
		x.addElement(new Float(s.substring(last_i, s.length())));
		s = vy;
		if(s.length()==0) return;
		for(i=0,last_i=0;i<s.length(); i++)
		{
			if(s.charAt(i)==',')
			{
				y.addElement(new Float(s.substring(last_i, i)));
				last_i = i+1;
			}
		}
		y.addElement(new Float(s.substring(last_i, s.length())));
		for(i=0;i<x.size();i++)
			Chart.getSeries(si).addValue(((Float)x.elementAt(i)).intValue(),((Float)y.elementAt(i)).floatValue());
	/*	int max=0;
		int min=0;
		for(i=0;i<x.size();i++)
		{
			max = max>((Float)x.elementAt(i)).intValue()?max:((Float)x.elementAt(i)).intValue();
			min = min<((Float)x.elementAt(i)).intValue()?min:((Float)x.elementAt(i)).intValue();
		}
		Chart.Bottom.setMaxMin(max,min);		 */
	}
	
	public void paint(Graphics g) 
	{
		setChart();
		Chart.drawCurveChart(g);
		//getGraphics().drawString(Integer.toString(Chart.getSeriesCount()-1),20,20) ;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -