二.还有一获得数据的类:XYUriData.JAVAclass XYUriData{
XYUriData(Reader reader) throws NoDataException{ try{
int i = 0;
StringBuffer sb = new StringBuffer();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
do{
i=reader.read();

if(i=='\r'){
if(!sb.toString().trim().equals("")){
StringTokenizer st = new StringTokenizer(sb.toString(),",");
g_data.add(
new Series(
sdf.parse(st.nextToken().trim()),st.nextToken(),Float.parseFloat(st.nextToken().trim()))));
}
sb=new StringBuffer();
reader.read();//跳过\n

}

sb.append((char)i);

}while(i>-1);
if(g_data.isEmpty()) throw new NoDataException();
}catch(ParseException ex){
      ex.printStackTrace();
//throw new RuntimeException(ex);
}catch(MalformedURLException ex){
ex.printStackTrace();
}catch(IOException ex){
ex.printStackTrace();
}
}
/**
 * 
 * @return
 */
public float nFormat(float f)
{
String strtemp="";
int num=0;
int leng=0;
strtemp=String.valueOf(f);
num=strtemp.indexOf(".")+1;
leng=strtemp.length();
if(num==0)
{
return f;
}
else
{
if(leng-num>1)
{

return Float.parseFloat(strtemp.substring(1,num+1));
}
else
{
return f;
}
}

}
/**

*/
private Set listSections() {
Set set = new TreeSet();
for(Iterator i = g_data.iterator();i.hasNext();)
{

set.add(((Series)i.next()).getSection());

}
return set;
}
private List g_data = new ArrayList();
/**

*/
private XYSeries getSeries(Object key){

        XYSeries series = new XYSeries((String)key);
        for (Iterator itr = g_data.iterator(); itr.hasNext(); ) {
            Series s = (Series) itr.next();
if(s.getSection().equals(key))
{
   series.add(s.getHitDate().getTime(), s.getHitCount());
   
}
}
return series;
}
/**
for xy chart
*/
public void addSeries(XYSeriesCollection xySeriesColl) throws NoDataException{
for(Iterator i=listSections().iterator();i.hasNext();){
xySeriesColl.addSeries(getSeries(i.next()));
}
}
class Series implements Comparable{
public int compareTo(Object o){
Series s = (Series)o;
return (s.section+s.hd).compareTo(section+hd);
}
        private float hc;
        private Date hd;
private String section;
        Series(Date d, String s, float l) {
            hc = l;
            hd = d;
section = s;
        }        float getHitCount() {
            return hc;
        }
String getSection(){
return section;
}
        Date getHitDate() {
            return hd;
        }
}
}