?? commoncurve.java
字號:
//<applet code=CommonCurve width=600 height=400>
//<param name=winsize value="600,400">
//<param name=Title value="甲班1#機 1_23456 中包溫度 (2003-9-10 12:34:55)">
//<param name=LeftTitle value="℃">
//<param name=BottomTitle value="分'秒">
//<param name=BottomMaxMin value="0,1200">
//<param name=LeftMaxMin value="1500,1600">
//<param name=LeftFormat value="n.0">
//<param name=LeftType value="1">
//<param name=BottomFormat value="n.0">
//<param name=BottomType value="1">
//<param name=SeriesTitle value="溫度">
//<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 CommonCurve extends Applet
{
CurveChart Chart;
int Width;
int Height;
public String getParameter(String get, String def)
{
return getParameter(get)!=null?getParameter(get):def;
}
public void init()
{
int i;
float LeftMax,LeftMin,BottomMax,BottomMin;
String win_size = getParameter("winsize","");
Width = Integer.parseInt(win_size.substring(0,win_size.indexOf(',')));
Height = Integer.parseInt(win_size.substring(win_size.indexOf(',')+1));
String LeftMaxMin = getParameter("LeftMaxMin","0,100");
LeftMax = Integer.parseInt(LeftMaxMin.substring(0,LeftMaxMin.indexOf(',')));
LeftMin = Integer.parseInt(LeftMaxMin.substring(LeftMaxMin.indexOf(',')+1));
String BottomMaxMin = getParameter("BottomMaxMin","0,1000");
BottomMax = Integer.parseInt(BottomMaxMin.substring(0,BottomMaxMin.indexOf(',')));
BottomMin = Integer.parseInt(BottomMaxMin.substring(BottomMaxMin.indexOf(',')+1));
resize(Width, Height);
Chart = new CurveChart(this, new Point(0,0),new Point(Width,Height));
try
{
Chart.setAxisVisible(true,true,false,false);
Chart.Left.setFormat( getParameter("LeftFormat","n.0"));
Chart.Bottom.setFormat( getParameter("BottomFormat","n.0"));
Chart.Bottom.setTextType(new Integer(getParameter("BottomType","1")).intValue());
Chart.Left.setTextType(new Integer(getParameter("LeftType","1")).intValue());
Chart.TitleColor=Color.red;
Chart.Left.setMaxMin(LeftMax,LeftMin);
Chart.Bottom.setMaxMin(BottomMax,BottomMin);
Chart.Left.setTitle(getParameter("LeftTitle",""));
Chart.Bottom.setTitle(getParameter("BottomTitle",""));
Chart.setTitle(getParameter("Title"));
Chart.clearSeries();
Chart.addSeries();
getValue(Chart);
Chart.getSeries(0).setTitle(getParameter("SeriesTitle",""));
Chart.getSeries(0).setColor(Color.blue);
}
catch(Exception e)
{
e.printStackTrace();
}
}
void getValue(CurveChart c)
{
Vector x = new Vector();
Vector y = new Vector();
int i;
int last_i;
String s = getParameter("ValueX");
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 = getParameter("ValueY");
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++)
c.getSeries(0).addValue(((Float)x.elementAt(i)).intValue(),((Float)y.elementAt(i)).intValue());
}
public void paint(Graphics g)
{
Chart.drawCurveChart(g);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -