欢迎来到天天文库
浏览记录
ID:61937646
大小:42.50 KB
页数:3页
时间:2021-03-31
《直方图饼图培训讲学.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、__________________________________________________开始输入数据数量number,数据array[],以及相应的数据名称Array[]i=0;总数SUM=0;i2、________________________________________________________________________________2、程序代码importjava.applet.*;importjava.awt.*;publicclassGraphextendsApplet{publicvoidpaint(Graphicsg){finalintarray[]={50,130,170,300,250,100};finalStringArray[]={"婴儿","儿童","少年","青年","中年"3、,"老年"};finalintnumber=6;intStartAngle=0,ArcAngle=0;finalintHIGH=450;inthigh=0,COLOR=0,wi=60;doubleroto=0;StringRoto="0";intSUM=0;for(inti=0;i4、Fontf=newFont("黑体",Font.TRUETYPE_FONT,20);g.setFont(f);g.drawString("图例:",50,HIGH+50);g.drawOval(600,200,HIGH,HIGH);//画圆for(inti=0;i5、ouble(high*3.6/10);ArcAngle=D1.intValue();COLOR=i*30;//颜色Colorc=newColor(10,225-COLOR,COLOR);g.setColor(c);if(i>0)wi=wi+35;g.fillRect(wi,(HIGH-high),25,high);//画直方图if(i==number-1)g.fillArc(600,200,HIGH,HIGH,StartAngle,360-StartAngle);_______________________________6、_____________________________________________________________________elseg.fillArc(600,200,HIGH,HIGH,StartAngle,ArcAngle);//饼图g.fillRect(50,HIGH+55+25*i,20,20);//以下为图例g.drawString(Array[i]+""+Roto+"%",100,HIGH+75+25*i);}//theendoffor(1)//}//theendofif}//theendofpai7、nt}//theendofTest2、运行结果输入的数据婴儿50,儿童130,少年170,青年300,中年250,老年100__________________________________________________
2、________________________________________________________________________________2、程序代码importjava.applet.*;importjava.awt.*;publicclassGraphextendsApplet{publicvoidpaint(Graphicsg){finalintarray[]={50,130,170,300,250,100};finalStringArray[]={"婴儿","儿童","少年","青年","中年"
3、,"老年"};finalintnumber=6;intStartAngle=0,ArcAngle=0;finalintHIGH=450;inthigh=0,COLOR=0,wi=60;doubleroto=0;StringRoto="0";intSUM=0;for(inti=0;i4、Fontf=newFont("黑体",Font.TRUETYPE_FONT,20);g.setFont(f);g.drawString("图例:",50,HIGH+50);g.drawOval(600,200,HIGH,HIGH);//画圆for(inti=0;i5、ouble(high*3.6/10);ArcAngle=D1.intValue();COLOR=i*30;//颜色Colorc=newColor(10,225-COLOR,COLOR);g.setColor(c);if(i>0)wi=wi+35;g.fillRect(wi,(HIGH-high),25,high);//画直方图if(i==number-1)g.fillArc(600,200,HIGH,HIGH,StartAngle,360-StartAngle);_______________________________6、_____________________________________________________________________elseg.fillArc(600,200,HIGH,HIGH,StartAngle,ArcAngle);//饼图g.fillRect(50,HIGH+55+25*i,20,20);//以下为图例g.drawString(Array[i]+""+Roto+"%",100,HIGH+75+25*i);}//theendoffor(1)//}//theendofif}//theendofpai7、nt}//theendofTest2、运行结果输入的数据婴儿50,儿童130,少年170,青年300,中年250,老年100__________________________________________________
4、Fontf=newFont("黑体",Font.TRUETYPE_FONT,20);g.setFont(f);g.drawString("图例:",50,HIGH+50);g.drawOval(600,200,HIGH,HIGH);//画圆for(inti=0;i5、ouble(high*3.6/10);ArcAngle=D1.intValue();COLOR=i*30;//颜色Colorc=newColor(10,225-COLOR,COLOR);g.setColor(c);if(i>0)wi=wi+35;g.fillRect(wi,(HIGH-high),25,high);//画直方图if(i==number-1)g.fillArc(600,200,HIGH,HIGH,StartAngle,360-StartAngle);_______________________________6、_____________________________________________________________________elseg.fillArc(600,200,HIGH,HIGH,StartAngle,ArcAngle);//饼图g.fillRect(50,HIGH+55+25*i,20,20);//以下为图例g.drawString(Array[i]+""+Roto+"%",100,HIGH+75+25*i);}//theendoffor(1)//}//theendofif}//theendofpai7、nt}//theendofTest2、运行结果输入的数据婴儿50,儿童130,少年170,青年300,中年250,老年100__________________________________________________
5、ouble(high*3.6/10);ArcAngle=D1.intValue();COLOR=i*30;//颜色Colorc=newColor(10,225-COLOR,COLOR);g.setColor(c);if(i>0)wi=wi+35;g.fillRect(wi,(HIGH-high),25,high);//画直方图if(i==number-1)g.fillArc(600,200,HIGH,HIGH,StartAngle,360-StartAngle);_______________________________
6、_____________________________________________________________________elseg.fillArc(600,200,HIGH,HIGH,StartAngle,ArcAngle);//饼图g.fillRect(50,HIGH+55+25*i,20,20);//以下为图例g.drawString(Array[i]+""+Roto+"%",100,HIGH+75+25*i);}//theendoffor(1)//}//theendofif}//theendofpai
7、nt}//theendofTest2、运行结果输入的数据婴儿50,儿童130,少年170,青年300,中年250,老年100__________________________________________________
此文档下载收益归作者所有