请问用AS脚本可以画出这么漂亮的图表吗?

kony_han 2004-09-22 11:30:04
请问用As可以画出这么漂亮的图表吗?
能不能我们国人也写一个这样的图表!完全用as画出来!
http://javabeanone.gro.clinux.org/flash/area2.swf
分不够再加!
...全文
532 36 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
36 条回复
切换为时间正序
请发表友善的回复…
发表回复
cuixiping 2005-03-20
  • 打赏
  • 举报
回复
下面这个也是牛烘烘的!不错!

Aurigma Flash Chart
http://www.aurigma.com/Products/FlashChart/ChartGallery.aspx

效果: (绝对是动态画图的,可以让你输入数据提交再显示的)
http://www.aurigma.com/Demo/FlashChart/Demo1.aspx
http://everythingcyber.com/Demo/FlashChart/Demo1.aspx (同一家的两个域名)
francais 2005-02-22
  • 打赏
  • 举报
回复
sp
billows2000 2005-02-20
  • 打赏
  • 举报
回复
关注!!!
artmouse 2005-02-20
  • 打赏
  • 举报
回复
flash绝对可以画出这样的图表,其实最好是做成一个组件,那就牛了。
zheng_hz 2005-02-18
  • 打赏
  • 举报
回复
http://www.dembicki.org/path/vawes.html
iwhiter 2004-10-13
  • 打赏
  • 举报
回复
用反编软件出来的代码学习可以,当成自己的就自恋了

有能力反编一下这个 :)

flex做的flash图表

http://coenraets.com/apps/load.jsp?app=mortgage/calc

不用怀疑了
A_San 2004-10-08
  • 打赏
  • 举报
回复
上面是一个chart组件的关键代码
A_San 2004-10-08
  • 打赏
  • 举报
回复
this['note']['noteItem'+k].lineTo(this.fontSize-2,0);
this['note']['noteItem'+k].endFill();

this['note']['noteItem'+k].createTextField('label',1,this.fontSize+2,-4,10,10);//绘制文字
this['note']['noteItem'+k]['label'].text=this.Data.childNodes[k].attributes.value;
this['note']['noteItem'+k]['label'].selectable=false;

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.Data.childNodes[k].attributes.color;
this['note']['noteItem'+k]['label'].setTextFormat(myTextFormat);

this['note']['noteItem'+k]['label']._width=this['note']['noteItem'+k]['label'].textWidth+this.fontSize;
this['note']['noteItem'+k]['label']._height=this['note']['noteItem'+k]['label'].textHeight+4;

if(k==(this.Data.childNodes.length-1) && sType!='pie') {
var noteX0=this.originWidth+5;
var noteY0=this.originHeight-(k+1)*this.fontSize*1.2+this.fontSize*0.2+2;
this.note.createEmptyMovieClip('noteItem0',0);

this['note']['noteItem0'].onPress=function(){
var cur=parseInt(this._name.substring(8));
for(var i=1;i<this._parent._parent.Data.childNodes.length;i++) {
this['_parent']['_parent']['graph']['shape'+i]._visible=true;
}
}
this['note']['noteItem0']._x=noteX0;
this['note']['noteItem0']._y=noteY0;

this['note']['noteItem0'].lineStyle(0, this.lineColor, 100);
this['note']['noteItem0'].beginFill(this.lineColor, this.opacity);
this['note']['noteItem0'].lineTo(0,this.fontSize-2);
this['note']['noteItem0'].lineTo(this.fontSize-2,this.fontSize-2);
this['note']['noteItem0'].lineTo(this.fontSize-2,0);
this['note']['noteItem0'].endFill();

this['note']['noteItem0'].createTextField('label',1,this.fontSize+2,-4,10,10);//绘制文字
this['note']['noteItem0']['label'].text='All';
this['note']['noteItem0']['label'].selectable=false;

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
this['note']['noteItem0']['label'].setTextFormat(myTextFormat);

this['note']['noteItem0']['label']._width=this['note']['noteItem0']['label'].textWidth+this.fontSize;
this['note']['noteItem0']['label']._height=this['note']['noteItem0']['label'].textHeight+4;
}
}
}

function setPoint(distance,scale) {
return distance*100/(scale*2);
}
function fixMax(obj,prop) {
if(obj.attributes[prop]>=1) {//大于1的情况
var tempMax=obj.attributes[prop];
// tempMax=Math.ceil(tempMax);
tempMax=Math.floor(tempMax);
tempLn=tempMax.toString().split('.')[0].length;
tempMax=Math.ceil(tempMax/Math.pow(10,tempLn-1)+1)*Math.pow(10,tempLn-1);
// tempMax=Math.ceil(tempMax/(tempLn>1?10:1))*(tempLn>1?10:1);
obj.attributes[prop]=tempMax;
}
else if(obj.attributes[prop]>0) {
var tempMax=obj.attributes[prop];
//var tempRadix=Math.max(0,Math.floor(-Math.log(tempMax))-1);
//取小数点后0的个数
var tempLn=0;
while(tempMax*10<1) {
tempMax*=10;
tempLn++;
}
// tempMax=Math.ceil(tempMax)/Math.pow(10,tempLn);
tempMax=(tempMax<=0.5?0.5:1)/Math.pow(10,tempLn);
obj.attributes[prop]=tempMax;
}
}

Object.registerClass("Subtype", SubtypeClass);
#endinitclip
A_San 2004-10-08
  • 打赏
  • 举报
回复
this['graph']['shape'+k]['mark'+i].setTextFormat(myTextFormat);
this['graph']['shape'+k]['mark'+i]._width=Math.min(this.originWidth/count-3,this['graph']['shape'+k]['mark'+i].textWidth+4);
this['graph']['shape'+k]['mark'+i]._height=this['graph']['shape'+k]['mark'+i].textHeight+4;
this['graph']['shape'+k]['mark'+i]._x=tx+tw/2-this['graph']['shape'+k]['mark'+i]._width/2;
this['graph']['shape'+k]['mark'+i]._y=ty-this['graph']['shape'+k]['mark'+i].textHeight-2;
}
}
break;

////////////////绘制饼图////////////////////////////////////////////////////////////////////////////////////////////
case 'pie':
var precision=72;

for(var k=1;k<this.Data.childNodes.length;k++){//绘制饼图
this.graph.createEmptyMovieClip('shape'+k,k);
if(k!=1)this['graph']['shape'+k]._visible=false;
var begin=0;

for(var j=0;j<count;j++) {
var end=begin+parseFloat(this.Data.childNodes[k].childNodes[j].attributes.value)/this.Data.childNodes[k].total*precision;
end=Math.round(end);
this['graph']['shape'+k].createEmptyMovieClip('pie'+j,j);
this['graph']['shape'+k]['pie'+j]._x=this.originX;
this['graph']['shape'+k]['pie'+j]._y=this.originY;

this['graph']['shape'+k]['pie'+j].onRollOver=function() {
new Color(this).setTransform({ra:'255',ga:'255',ba:'255'});
}
this['graph']['shape'+k]['pie'+j].onRollOut=this['graph']['shape'+k]['pie'+j].onDragOut=function() {
new Color(this).setTransform({ra:'100',ga:'100',ba:'100'});
}
for(var i=begin;i<(end+1);i++) {
var terminalX=setPoint(this.originWidth,this._xscale)*Math.sin(i*Math.PI*2/precision+Math.PI);
var terminalY=setPoint(this.originHeight,this._yscale)*Math.cos(i*Math.PI*2/precision+Math.PI);

if(i!=begin) {//圆弧线
this['graph']['shape'+k]['pie'+j].lineStyle(0, this.lineColor, 100);
this['graph']['shape'+k]['pie'+j].lineTo(terminalX,terminalY);
}
else {//起点
var tempColor=this.Data.firstChild.childNodes[j].attributes.color;
if(tempColor==undefined) tempColor=this.Data.childNodes[k].attributes.color;
if(tempColor==undefined) tempColor=0x000000;
this['graph']['shape'+k]['pie'+j].beginFill(tempColor, this.opacity);
this['graph']['shape'+k]['pie'+j].lineStyle(0, this.lineColor, 0);

this['graph']['shape'+k]['pie'+j].moveTo(0,0);
this['graph']['shape'+k]['pie'+j].lineTo(terminalX,terminalY);
}
if(i==end) {//终止
if(j==(count-1))this['graph']['shape'+k]['pie'+j].lineTo(0,-setPoint(this.originHeight,this._yscale));
this['graph']['shape'+k]['pie'+j].lineStyle(0, this.lineColor, 100);
this['graph']['shape'+k]['pie'+j].lineTo(0,0);
this['graph']['shape'+k]['pie'+j].endFill();

this['graph']['shape'+k]['pie'+j].createTextField('label',1,0,0,10,10);
this['graph']['shape'+k]['pie'+j]['label'].text=this.Data.firstChild.childNodes[j].attributes.value+'\n'+Math.round(parseFloat(this.Data.childNodes[k].childNodes[j].attributes.value)/this.Data.childNodes[k].total*100)+'%';

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
myTextFormat.align = 'center';
this['graph']['shape'+k]['pie'+j]['label'].setTextFormat(myTextFormat);

this['graph']['shape'+k]['pie'+j]['label']._width=this['graph']['shape'+k]['pie'+j]['label'].textWidth+3;
this['graph']['shape'+k]['pie'+j]['label']._height=this['graph']['shape'+k]['pie'+j]['label'].textHeight+4;

this['graph']['shape'+k]['pie'+j]['label']._x=(setPoint(this.originWidth,this._xscale)*Math.sin((begin+end)*Math.PI/precision+Math.PI))/1.6-this['graph']['shape'+k]['pie'+j]['label']._width/2;
this['graph']['shape'+k]['pie'+j]['label']._y=(setPoint(this.originHeight,this._yscale)*Math.cos((begin+end)*Math.PI/precision+Math.PI))/1.6-this['graph']['shape'+k]['pie'+j]['label']._height/2;
}
}
begin=end;
}
}
break;
}
for(var k=1;k<this.Data.childNodes.length;k++) {
//绘制注释
var noteX0=this.originWidth+5;
var noteY0=this.originHeight-k*this.fontSize*1.2+this.fontSize*0.2+2;

this.note.createEmptyMovieClip('noteItem'+k,k);

this['note']['noteItem'+k].onPress=function(){
var cur=parseInt(this._name.substring(8));
for(var i=1;i<this._parent._parent.Data.childNodes.length;i++) {
if(i!=cur)this['_parent']['_parent']['graph']['shape'+i]._visible=false;
}
this['_parent']['_parent']['graph']['shape'+cur]._visible=true;
}
this['note']['noteItem'+k]._x=noteX0;
this['note']['noteItem'+k]._y=noteY0;

var tempColor=this.Data.childNodes[k].attributes.color;
if(tempColor==undefined) tempColor=0x000000;
this['note']['noteItem'+k].lineStyle(0,tempColor , 100);
this['note']['noteItem'+k].beginFill(tempColor, this.opacity);
this['note']['noteItem'+k].lineTo(0,this.fontSize-2);
this['note']['noteItem'+k].lineTo(this.fontSize-2,this.fontSize-2);
zheng_hz 2004-10-08
  • 打赏
  • 举报
回复
var ty=this.originHeight*(1-parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)/parseFloat(this.Data.firstChild.attributes.max));
if(i==0)this['graph']['shape'+k].moveTo(tx,ty);
else this['graph']['shape'+k].lineTo(tx,ty);
//显示标注数字
this['graph']['shape'+k].createTextField('mark'+i,i+1,0,0,1,10);
this['graph']['shape'+k]['mark'+i].text=this.Data.childNodes[k].childNodes[i].attributes.value;
var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.Data.childNodes[k].attributes.color;
this['graph']['shape'+k]['mark'+i].setTextFormat(myTextFormat);
this['graph']['shape'+k]['mark'+i]._width=Math.min(this.originWidth/count-3,this['graph']['shape'+k]['mark'+i].textWidth+4);
this['graph']['shape'+k]['mark'+i]._height=this['graph']['shape'+k]['mark'+i].textHeight+4;
this['graph']['shape'+k]['mark'+i]._x=tx-this['graph']['shape'+k]['mark'+i]._width/2;
if(parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)<parseFloat(this.Data.childNodes[k].childNodes[i-1].attributes.value))this['graph']['shape'+k]['mark'+i]._y=ty-2;
else this['graph']['shape'+k]['mark'+i]._y=ty-this['graph']['shape'+k]['mark'+i].textHeight-2;
}
}
break;
////////////////绘制柱状图////////////////////////////////////////////////////////////////////////////////////////////
case 'histogram':

//修正最大值
if(this.Data.firstChild.firstChild.attributes.max==undefined) {
fixMax(this.Data.firstChild,'max');
}
//绘制参考线
this.coords.lineStyle(0, this.lineColor, 20);
var guideline=5;
for(var i=0;i<guideline;i++) {
this.coords.moveTo(0,this.originHeight/guideline*i);
this.coords.lineTo(this.originWidth,this.originHeight/guideline*i);

this.coords.createTextField('guide'+i,-i-1,0,0,1,10);
this['coords']['guide'+i].text=this.Data.firstChild.attributes.max*(1-i/guideline);

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
this['coords']['guide'+i].setTextFormat(myTextFormat);

this['coords']['guide'+i]._width=this['coords']['guide'+i].textWidth+4;
this['coords']['guide'+i]._height=this['coords']['guide'+i].textHeight+4;
this['coords']['guide'+i]._x=-this['coords']['guide'+i]._width;
this['coords']['guide'+i]._y=this.originHeight/guideline*i-this['coords']['guide'+i]._height/2;
}

this.coords.lineStyle(0, this.lineColor, 100);
this.coords.moveTo(0,0);
this.coords.lineTo(0,this.originHeight);
this.coords.lineTo(this.originWidth,this.originHeight);

for(var i=0;i<count;i++) {//显示字段名称
this.coords.createTextField('label'+i,i+1,0,0,1,10);
this['coords']['label'+i].text=this.Data.firstChild.childNodes[i].attributes.value;

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
this['coords']['label'+i].setTextFormat(myTextFormat);

this['coords']['label'+i]._width=Math.min(this.originWidth/count-3,this['coords']['label'+i].textWidth+4);
this['coords']['label'+i]._height=this['coords']['label'+i].textHeight+4;
this['coords']['label'+i]._x=this.originWidth*(i+1/2)/count-this['coords']['label'+i]._width/2;
this['coords']['label'+i]._y=this.originHeight;
this.coords.moveTo(this.originWidth*(i+1)/count,this.originHeight);
this.coords.lineTo(this.originWidth*(i+1)/count,this.originHeight-3);
}

var tw=this.originWidth/count*(Math.min(0.8,(this.Data.childNodes.length-1)*0.1+0.4))/(this.Data.childNodes.length-1);

for(var k=1;k<this.Data.childNodes.length;k++) {//绘制图形
this.graph.createEmptyMovieClip('shape'+k,k);

for(var i=0;i<count;i++) {
var tx=(this.originWidth/count-(this.Data.childNodes.length-1)*tw)/2+tw*(k-1)+this.originWidth/count*i;
var ty=this.originHeight*(1-parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)/parseFloat(this.Data.firstChild.attributes.max));

var tempColor=this.Data.childNodes[k].attributes.color;
if(tempColor==undefined)tempColor=0x000000;
this['graph']['shape'+k].lineStyle(0, tempColor, 100);
this['graph']['shape'+k].beginFill(tempColor, this.opacity);
this['graph']['shape'+k].moveTo(tx,this.originHeight);
this['graph']['shape'+k].lineTo(tx,ty);
this['graph']['shape'+k].lineTo(tx+tw,ty);
this['graph']['shape'+k].lineTo(tx+tw,this.originHeight);

this['graph']['shape'+k].lineStyle(0, tempColor, 0);
this['graph']['shape'+k].lineTo(tx,this.originHeight);
this['graph']['shape'+k].endFill();

//显示标注数字
this['graph']['shape'+k].createTextField('mark'+i,i+1,0,0,1,10);
this['graph']['shape'+k]['mark'+i].text=this.Data.childNodes[k].childNodes[i].attributes.value;
var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.Data.childNodes[k].attributes.color;
zheng_hz 2004-10-08
  • 打赏
  • 举报
回复
if(tempColor==undefined) tempColor=0x000000;
this['graph']['shape'+k].lineStyle(0, tempColor, 100);
this['graph']['shape'+k].beginFill (tempColor, this.opacity);
for(var i=0;i<count;i++) {//绘制图形
if(i==0) {
var currentX=this.originX+setPoint(this.originWidth*parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)/parseFloat(this.Data.firstChild.childNodes[i].attributes.tmax),this._xscale)*Math.sin(i*Math.PI*2/count+Math.PI);
var currentY=this.originY+setPoint(this.originHeight*parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)/parseFloat(this.Data.firstChild.childNodes[i].attributes.tmax),this._yscale)*Math.cos(i*Math.PI*2/count+Math.PI);
this['graph']['shape'+k].moveTo(currentX, currentY);
}
var j=i+1;
if(i==count-1){
this['graph']['shape'+j].lineTo(currentX,currentY);
}
else {
var terminalX=this.originX+setPoint(this.originWidth*parseFloat(this.Data.childNodes[k].childNodes[j].attributes.value)/parseFloat(this.Data.firstChild.childNodes[j].attributes.tmax),this._xscale)*Math.sin(j*Math.PI*2/count+Math.PI);
var terminalY=this.originY+setPoint(this.originHeight*parseFloat(this.Data.childNodes[k].childNodes[j].attributes.value)/parseFloat(this.Data.firstChild.childNodes[j].attributes.tmax),this._yscale)*Math.cos(j*Math.PI*2/count+Math.PI);
this['graph']['shape'+k].lineTo(terminalX,terminalY);

}
//显示标注数字
var terminalX=this.originX+setPoint((this.originWidth+this.fontSize*1.5)*parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)/parseFloat(this.Data.firstChild.childNodes[i].attributes.tmax),this._xscale)*Math.sin(i*Math.PI*2/count+Math.PI);
var terminalY=this.originY+setPoint((this.originHeight+this.fontSize*1.5)*parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value)/parseFloat(this.Data.firstChild.childNodes[i].attributes.tmax),this._yscale)*Math.cos(i*Math.PI*2/count+Math.PI);
this['graph']['shape'+k].createTextField('mark'+i,i+1,0,0,1,10);
this['graph']['shape'+k]['mark'+i].text=this.Data.childNodes[k].childNodes[i].attributes.value;
var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.Data.childNodes[k].attributes.color;
this['graph']['shape'+k]['mark'+i].setTextFormat(myTextFormat);
this['graph']['shape'+k]['mark'+i]._width=Math.min(this.originWidth/count-3,this['graph']['shape'+k]['mark'+i].textWidth+4);
this['graph']['shape'+k]['mark'+i]._height=this['graph']['shape'+k]['mark'+i].textHeight+4;
this['graph']['shape'+k]['mark'+i]._x=terminalX-this['graph']['shape'+k]['mark'+i]._width/2;
this['graph']['shape'+k]['mark'+i]._y=terminalY-this['graph']['shape'+k]['mark'+i]._height/2;

}
this['graph']['shape'+k].endFill();
}
break;
////////////////绘制折线图////////////////////////////////////////////////////////////////////////////////////////////
case 'line':

//修正最大值
if(this.Data.firstChild.firstChild.attributes.max==undefined) {
fixMax(this.Data.firstChild,'max');
}
//绘制参考线
this.coords.lineStyle(0, this.lineColor, 20);
var guideline=5;
for(var i=0;i<guideline;i++) {
this.coords.moveTo(0,this.originHeight/guideline*i);
this.coords.lineTo(this.originWidth,this.originHeight/guideline*i);

this.coords.createTextField('guide'+i,-i-1,0,0,1,10);
this['coords']['guide'+i].text=this.Data.firstChild.attributes.max*(1-i/guideline);

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
this['coords']['guide'+i].setTextFormat(myTextFormat);

this['coords']['guide'+i]._width=this['coords']['guide'+i].textWidth+4;
this['coords']['guide'+i]._height=this['coords']['guide'+i].textHeight+4;
this['coords']['guide'+i]._x=-this['coords']['guide'+i]._width;
this['coords']['guide'+i]._y=this.originHeight/guideline*i-this['coords']['guide'+i]._height/2;
}

this.coords.lineStyle(0, this.lineColor, 100);
this.coords.moveTo(0,0);
this.coords.lineTo(0,this.originHeight);
this.coords.lineTo(this.originWidth,this.originHeight);

for(var i=0;i<count;i++) {//显示字段名称
this.coords.createTextField('label'+i,i+1,0,0,1,10);
this['coords']['label'+i].text=this.Data.firstChild.childNodes[i].attributes.value;

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
this['coords']['label'+i].setTextFormat(myTextFormat);

this['coords']['label'+i]._width=Math.min(this.originWidth/count-3,this['coords']['label'+i].textWidth+4);
this['coords']['label'+i]._height=this['coords']['label'+i].textHeight+4;
this['coords']['label'+i]._x=this.originWidth*(i+1/2)/count-this['coords']['label'+i]._width/2;
this['coords']['label'+i]._y=this.originHeight;
this.coords.moveTo(this.originWidth*(i+1)/count,this.originHeight);
this.coords.lineTo(this.originWidth*(i+1)/count,this.originHeight-3);
}

for(var k=1;k<this.Data.childNodes.length;k++) {//绘制图形
this.graph.createEmptyMovieClip('shape'+k,k);

var tempColor=this.Data.childNodes[k].attributes.color;
if(tempColor==undefined) tempColor=0x000000;
this['graph']['shape'+k].lineStyle(0, tempColor, 100);
this['graph']['shape'+k].moveTo(this.originWidth/(count*2),this.originHeight*(1-parseFloat(this.Data.childNodes[k].firstChild.attributes.value)/parseFloat(this.Data.firstChild.attributes.max)));

for(var i=0;i<count;i++) {
var tx=this.originWidth/count*(i+1/2);
zheng_hz 2004-10-08
  • 打赏
  • 举报
回复
#initclip

function SubtypeClass () {
this.placeholder_border._visible=false;
this.originX=this._width/2;
this.originY=this._height/2;
this.originWidth=this._width;
this.originHeight=this._height;
this._xscale=100;
this._yscale=100;
this.readData(this.url);
}

SubtypeClass.prototype = new MovieClip();

SubtypeClass.prototype.readData=function(url) {
this.createEmptyMovieClip('theTester',-1000);
var tmpData = new XML();
System.useCodePage = true;
tmpData.ignoreWhite = true;
tmpData.load(url);

this.theTester.onEnterFrame=function() {
if(tmpData.loaded) {
delete this.onEnterFrame;
this._parent.Data=tmpData.firstChild;
this._parent.drawGraph(this._parent.subType);
}
}
}

SubtypeClass.prototype.drawGraph=function(sType) {
this.subType=sType;
var count=this.Data.firstChild.childNodes.length;

for(var k=1;k<this.Data.childNodes.length;k++) {//取得各项的最大值等参数
this.Data.childNodes[k].total=0;
for(var i=0;i<count;i++) {
this.Data.childNodes[k].total+=parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value);

var att=this.Data.firstChild.childNodes[i].attributes;
if(att.max!=undefined)att.tmax=att.max;
else if(k>1)att.tmax=Math.max(att.tmax,parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value));
else att.tmax=parseFloat(this.Data.childNodes[k].childNodes[i].attributes.value);

var totalatt=this.Data.firstChild.attributes;//取得所有项的最大值
if(k>1)totalatt.max=Math.max(att.tmax,totalatt.max);
else totalatt.max=att.tmax;
}
}


this.createEmptyMovieClip('coords',0);
this.createEmptyMovieClip('graph',1);
this.createEmptyMovieClip('note',2);


switch(sType) {
////////////////绘制雷达图////////////////////////////////////////////////////////////////////////////////////////////
case 'radar':
for(var i=0;i<count;i++) {//显示文字
//修正各项最大值
if(this.Data.firstChild.childNodes[i].attributes.max==undefined) {
fixMax(this.Data.firstChild.childNodes[i],'tmax');
}
var terminalX=this.originX+setPoint(this.originWidth,this._xscale)*Math.sin(i*Math.PI*2/count+Math.PI);
var terminalY=this.originY+setPoint(this.originHeight,this._yscale)*Math.cos(i*Math.PI*2/count+Math.PI);

this.coords.lineStyle(0, this.lineColor, 100);
if(i!=0) {
this.coords.lineTo(terminalX,terminalY);
}
else {
this.coords.moveTo(terminalX,terminalY);
this.coords.lineTo(this.originX+setPoint(this.originWidth,this._xscale)*Math.sin((count-1)*Math.PI*2/count+Math.PI),this.originY+setPoint(this.originHeight,this._yscale)*Math.cos((count-1)*Math.PI*2/count+Math.PI));
}

this.coords.lineStyle(0, this.lineColor, 20);
this.coords.moveTo(this.originX, this.originY);
this.coords.lineTo(terminalX,terminalY);

this.coords.createTextField('label'+i,i+1,0,0,10,10);
this['coords']['label'+i].text=this.Data.firstChild.childNodes[i].attributes.value;

var myTextFormat = new TextFormat();
myTextFormat.font = this.fontFamily;
myTextFormat.size = this.fontSize;
myTextFormat.color = this.fontColor;
this['coords']['label'+i].setTextFormat(myTextFormat);

this['coords']['label'+i]._width=this['coords']['label'+i].textWidth+3;
this['coords']['label'+i]._height=this['coords']['label'+i].textHeight+4;
this['coords']['label'+i]._x=this.originX+setPoint((this.originWidth+this.fontSize*1.5),this._xscale)*Math.sin(i*Math.PI*2/count+Math.PI)-this['coords']['label'+i]._width/2;
this['coords']['label'+i]._y=this.originY+setPoint((this.originHeight+this.fontSize*1.5),this._yscale)*Math.cos(i*Math.PI*2/count+Math.PI)-this['coords']['label'+i]._height/2;

}

for(var k=1;k<this.Data.childNodes.length;k++) {
this.graph.createEmptyMovieClip('shape'+k,k);
var tempColor=this.Data.childNodes[k].attributes.color;
lewfn 2004-09-30
  • 打赏
  • 举报
回复
我认为,单用代码,写不出来,至少我写不出来。
应该是动画做的。
iwhiter 2004-09-29
  • 打赏
  • 举报
回复
to:zheng_hz(鸿鹄)

都看书还来讨论什么?你要是有想法就说出来大家讨论
折线和sin都简单,你既然有兴趣就自己调试一下,哪怕半成品拿上来大家交流下

说出来大家交流学习~

拿出来,我是真的想看
linuxbing 2004-09-29
  • 打赏
  • 举报
回复
to:kony_han(hcs)
我也正有此意阿,呵呵!!!
我现在正在做最简单的柱型动态图,做好后共享。感觉还是相当有用di
zheng_hz 2004-09-29
  • 打赏
  • 举报
回复
iwhiter(包子) 不要搞人生攻击。

曲线拟合是个数学问题,你要想搞明白,自己去看书,也没必要来骂我么。
linuxbing 2004-09-29
  • 打赏
  • 举报
回复
学习学习!!!
iwhiter 2004-09-28
  • 打赏
  • 举报
回复
姓zheng的,不会只长一张鸟嘴放屁吧!
iwhiter 2004-09-28
  • 打赏
  • 举报
回复
楼上得2鸟 讲一下你得曲线拟合手段
zheng_hz 2004-09-28
  • 打赏
  • 举报
回复
就是不会才关注阿.
加载更多回复(16)

2,278

社区成员

发帖
与我相关
我的任务
社区描述
多媒体/设计/Flash/Silverlight 开发 Flash流媒体开发
社区管理员
  • Flash流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧