};
//求数据对象的最大value
_p.maxs = function(){
var max = 0;
for(var i=0; i<this.seriescollection.length; i++){
if(max<this.seriescollection[i].max()) max = this.seriescollection[i].max();
}
return max;
}
//重载object的tostring方法
_p.tostring = function(){
return "ograph";
};
//定义 vml chart 边框类
function border(){
this.color = "black";
this.style = bstsingle;
this.width = 1;
};
//定义 vml chart 背景类
function fill(){
this.color = "white";
this.background = null;
this.style = fstsolid;
};
//定义 vml chart 标题类
function text(){
this.alignment = atcenter;
this.height = 24;
this.font = new font();
this.text = "vml chart version 1.0";
};
//定义 vml chart 字体类
function font(){
this.color = "black";
this.family = "arial";
this.size = 12;
this.style = fstregular;
};
//定义 vml chart 图例类
function legend(){
this.font = new font();
};
//定义 vml chart 序列类
function series(){
this.color = series.getcolor();
this.title = null;
this.all = [];
};
//随机获取一种颜色
series.getcolor = function(){
return "rgb("+math.round(math.random()*255)+","+math.round(math.random()*255)+","+math.round(math.random()*255)+")";
};
var _p = series.prototype;
//增加具体数据
_p.adddata = function(sname,svalue,shref,stooltiptext){
var odata = new object();
odata.name = sname;
odata.value = svalue;
odata.href = shref;
if(stooltiptext == null || stooltiptext == "undefined")
odata.tooltiptext="本项数值为:"+ svalue;
else
odata.tooltiptext = stooltiptext;
var icount=this.all.length;
this.all[icount] = odata;
};
//求数据对象的最大value
_p.max = function(){
var max = 0;
for(var i=0; i<this.all.length; i++){
if(this.all[i].value > max) max = this.all[i].value;
}
return max;
}
//重载object的tostring方法
_p.tostring = function(){
return "oseries";
};
//定义 vml chart 时间序列类
function timeseries(){
series.call(this);
};
var _p = timeseries.prototype = new series;
//增加具体数据
_p.adddata = function(stime,svalue,stype,shref,stooltiptext){
var odata = new object();
var dt = new date(eval(stime*1000));
if(stype == "minute"){
odata.name = dt.gethours() +":"+ dt.getminutes();
}
else if(stype == "hour"){
odata.name = dt.gethours();
}
else if(stype == "day"){
odata.name = eval(dt.getmonth()+1) +"月"+ dt.getdate() +"日";
}
else if(stype == "month"){
odata.name = dt.getyear() +"年"+ eval(dt.getmonth()+1)+ "月";
}
else{
odata.name = dt.getyear() +"年"
}
odata.value = svalue;
odata.href = shref;
odata.tooltiptext = "本项数值为:"+ svalue + ", 时间:"+ dt.getyear() +"年"+ eval(dt.getmonth()+1)+ "月"+ dt.getdate() +"日 "+ dt.gethours() +":"+ dt.getminutes() +":"+ dt.getseconds();
var icount=this.all.length;
this.all[icount] = odata;
};
//重载object的tostring方法
_p.tostring = function(){
return "otimeseries";
};
//定义 vml chart 坐标轴类
function axis(){
this.color = "black";
this.ln = 0;
this.numberformat = 0;
this.prefix = null;
this.suffix = null;
this.spacing= 30;
this.width = 0;
this.showpoint = 12;
};
//verticalchart类,继承graph
function verticalchart(){
graph.call(this);
this.margin = new array(300,100,300,200);
this.axisx = new axis();
this.axisy = new axis();
};
var _p = verticalchart.prototype = new graph;
//画坐标系
_p.drawcoord = function(ocontainer){
this.axisy.ln = eval(this.height*10 - this.margin[3]) - this.margin[1] - 400;
var vline = document.createelement("v:line");
vline.id = "idcoordy";
vline.from = this.margin[0] +","+ this.margin[1];
vline.to = this.margin[0] +","+ eval(this.height*10 - this.margin[3]);
vline.style.zindex = 8;
vline.style.position = "absolute";
vline.strokecolor = this.axisy.color;
vline.strokeweight = 1;
var vstroke = document.createelement("v:stroke");
vstroke.startarrow = "classic";
vline.appendchild(vstroke);