asp饼状比例图组件高分求购 (200分)

  • 主题发起人 主题发起人 xanadu
  • 开始时间 开始时间
X

xanadu

Unregistered / Unconfirmed
GUEST, unregistred user!
哪位人兄知道有没有asp的画图组件。
就是excel里经常用到的那种圆饼状的比例图,还有就是柱状的比较图(和上一年度比较用的)。
图表最好有不同的颜色可以标识出来各自所占的比例。
最好有现成的组件,多谢!
 
C#builder中的ComponentOne組件有
 
直接用Office WEB Component 不就行了?
 
Office WEB Component 挺好用的,你可以看看它的帮助文件:
"C:/Program Files/Microsoft Office/Office/2052/MSOWCVBA.CHM"
 
你说的是不是用ASP网页实现在线投票样式的东西?
显示的柱有高有低,80% ?????
这也太好办了。
如果你不会来信我给原码。
 
这是我以前做的一Asp组件 供参考
unit PieU;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows,ComObj, ActiveX, Ge_Soft_OA_TLB, StdVcl,classes,types,Graphics,jpeg,SysUtils,ExtCtrls, TeeProcs, TeEngine, Chart;
type
TPie = class(TAutoObject, IPie)
private
intWidth:integer;
intHeight:integer;
itemCount:integer;
itemNames:String;
itemValues:String;
intHJ:integer;
strList1:TStringList;
PrintText:TStringList;
function GetPixValue(index:integer):TPoint;
protected
procedure SaveAs(const filename: WideString);
safecall;
procedure Set_Height(Value: Integer);
safecall;
procedure Set_ItemCount(Value: Integer);
safecall;
procedure Set_ItemNames(const Value: WideString);
safecall;
procedure Set_ItemValues(const Value: WideString);
safecall;
procedure Set_Width(Value: Integer);
safecall;
procedure Close;
safecall;
procedure Create;
safecall;
end;

implementation
uses ComServ, MyFunction;

function TPie.GetPixValue(index: integer): TPoint;
var
i:integer;
Angle:Single;
intTemp:integer;
begin
intTemp:=0;
for i:=0 to index-1do
intTemp:=intTemp + strToInt(strList1.Strings);
Angle:=(intTemp / intHJ) * 2 * PI;
//计算当前角的弧度值
Result.X:=Round(intHeight * 0.5 * cos(Angle) + intHeight * 0.5);
Result.Y:= 0 - Round(intHeight * 0.5 * sin(Angle) - intHeight * 0.5);
end;

procedure TPie.SaveAs(const filename: WideString);
var
objIMG:TBitmap;
objJPG:TJPEGImage;
sp1:TPoint;
sp2:TPoint;
i:integer;
objColor:TColor;
begin
objIMG:=TBitmap.Create;
objIMG.Width:=intWidth;
objIMG.Height:=intHeight;
for i:=1 to itemCountdo
begin
//定义颜色
Case i of
1:objColor:=TColor(RGB(108,128,236));
2:objColor:=TColor(RGB(255,204,0));
3:objColor:=TColor(RGB(255,111,0));
4:objColor:=TColor(RGB(12,111,23));
5:objColor:=TColor(RGB(222,1,4));
6:objColor:=TColor(RGB(66,222,111));
7:objColor:=TColor(RGB(100,100,100));
8:objColor:=TColor(RGB(202,50,100));
9:objColor:=TColor(RGB(44,22,200));
else
objColor:=TColor(RGB(Random(255),Random(255),Random(255)));
end;
///////////////////
objIMG.Canvas.Brush.Color:=objColor;
objIMG.Canvas.Pen.Color:=objColor;
objIMG.Canvas.Brush.Style:=bsSolid;
sp1:=GetPixValue(i-1);
sp2:=GetPixValue(i);
objIMG.Canvas.Pie(0,0,intHeight,intHeight,sp1.X,sp1.y,sp2.X,sp2.Y);
objIMG.Canvas.Rectangle(intHeight + 20, i * 15,intHeight + 20 + 10,i * 15 +10);
objIMG.Canvas.Brush.Color:=clWhite;
objIMG.Canvas.TextOut(intHeight + 20 + 10 + 8 ,i * 15,PrintText.Strings[i-1]);
end;

objJPG:=TJPEGImage.Create;
objJPG.Assign(objIMG);
objJPG.CompressionQuality:=100;
objJPG.Compress;
objJPG.SaveToFile(filename);
objJPG.Free;
objIMG.Free;
end;

procedure TPie.Set_Height(Value: Integer);
begin
intHeight:=Value;
end;

procedure TPie.Set_ItemCount(Value: Integer);
begin
ItemCount:=Value;
end;

procedure TPie.Set_ItemNames(const Value: WideString);
var
i:integer;
intbfs:integer;
intbsfzj:integer;
begin
ItemNames:=Value;
//生成输出文本
PrintText:=SplitString(itemNames,',');
intbsfzj:=0;
for i:=0 to itemCount-1do
begin
if (i=itemCount-1) then
begin
PrintText.Strings:=PrintText.Strings + ' ' + intToStr(100-intbsfzj) + '%';
end
else
begin
intbfs:=Round(strToInt(strList1.Strings) / intHJ * 100);
intbsfzj:=intbsfzj + intbfs ;
PrintText.Strings:=PrintText.Strings + ' ' + intToStr(intbfs) + '%';
end;
end;
end;

procedure TPie.Set_ItemValues(const Value: WideString);
var
i:integer;
begin
ItemValues:=Value;
strList1:=SplitString(itemValues,',');
intHJ:=0;
for i:=0 to strList1.Count-1do
begin
intHJ := intHJ + strToInt(strList1.Strings);
end;
end;

procedure TPie.Set_Width(Value: Integer);
begin
intWidth:=Value;
end;

procedure TPie.Close;
begin
strList1.Free;
PrintText.Free;
end;

procedure TPie.Create;
begin
strList1:=TStringList.Create;
PrintText:=TStringList.Create;
end;

initialization
TAutoObjectFactory.Create(ComServer, TPie, Class_Pie,
ciMultiInstance, tmApartment);
end.

 
哪要那么麻烦啊?
不是有MSCHART控件吗?和EXECLE里的一个样啊!很方便很方便,你如果有vb6可以自己做一个控件把MSCHART封进去,如果搞不定留下EMAIL,下次我再看贴时发给你.
 
装了VB6就有那个activex控件了!就是楼上说的MSCHART,具体使用我也不清楚[:D]因为是activex所以ASP肯定可以使用的!
 
我的Email: fush@163.com
太感谢你们了。
 
兄弟因工作需要同时使用delphi和ASP,非常愿意与有相同工作环境的朋友交流.
强烈推荐下面的存ASP画图函数.
<%
function table3(total,table_x,table_y,all_width,all_height,table_type)
'参数含义(传递的数组,横坐标,纵坐标,图表的宽度,图表的高度,图表的类型)
'纯ASP代码生成图表函数3--饼图
'作者:龚鸣(Passwordgm) QQ:25968152 MSN:passwordgm@sina.com Email:passwordgm@sina.com
'本人非常愿意和ASP,VML,FLASH的爱好者在HTTP://topclouds.126.com进行交流和探讨
'版本1.0 最后修改日期 2003-8-11
'非常感谢您使用这个函数,请您使用和转载时保留版权信息,这是对作者工作的最好的尊重。
tb_height=30
dim tb_color(7,2)
tb_color(1,1)="#d1ffd1"
tb_color(2,1)="#ffbbbb"
tb_color(3,1)="#ffe3bb"
tb_color(4,1)="#cff4f3"
tb_color(5,1)="#d9d9e5"
tb_color(6,1)="#ffc7ab"
tb_color(7,1)="#ecffb7"
tb_color(1,2)="#00ff00"
tb_color(2,2)="#ff0000"
tb_color(3,2)="#ff9900"
tb_color(4,2)="#33cccc"
tb_color(5,2)="#666699"
tb_color(6,2)="#993300"
tb_color(7,2)="#99cc00"
total_no=ubound(total,1)
totalpie=0
for i=1 to total_no
totalpie=totalpie+total(i,1)
next
PreAngle=0
for i=1 to total_no
response.write "<v:shape id='_x0000_s1025' alt='' style='position:absolute;left:"&amp;table_x&amp;"px;top:"&amp;table_y&amp;"px;width:"&amp;all_width&amp;"px;height:"&amp;all_height&amp;"px;z-index:1' coordsize='1500,1400' o:spt='100' adj='0,,0' path='m750,700ae750,700,750,700,"&amp;int(23592960*PreAngle)&amp;","&amp;int(23592960*total(i,1)/totalpie)&amp;"xe' fillcolor='"&amp;tb_color(i,1)&amp;"' strokecolor='#FFFFFF'><v:fill color2='"&amp;tb_color(i,2)&amp;"' rotate='t' focus='100%' type='gradient'/><v:stroke joinstyle='round'/><v:formulas/><v:path o:connecttype='segments'/></v:shape>"&amp;CHr(13)
PreAngle=PreAngle+total(i,1)/totalpie
next
if table_type="A" then
response.write "<v:rect id='_x0000_s1025' style='position:absolute;left:"&amp;table_x+all_width+20&amp;"px;top:"&amp;table_y+20&amp;"px;width:100px;height:"&amp;total_no*tb_height+20&amp;"px;z-index:1'/>"
for i=1 to total_no
response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&amp;table_x+all_width+25&amp;"px;top:"&amp;table_y+30+(i-1)*tb_height&amp;"px;width:60px;height:"&amp;tb_height&amp;"px;z-index:1'>"
response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>"&amp;total(i,0)&amp;"</td></tr></table></v:textbox></v:shape>"
response.write "<v:rect id='_x0000_s1040' alt='' style='position:absolute;left:"&amp;table_x+all_width+80&amp;"px;top:"&amp;table_y+30+(i-1)*tb_height+3&amp;"px;width:30px;height:20px;z-index:1' fillcolor='"&amp;tb_color(i,1)&amp;"'><v:fill color2='"&amp;tb_color(i,2)&amp;"' rotate='t' focus='100%' type='gradient'/></v:rect>"
'显示比例数
' response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&amp;table_x+all_width+110&amp;"px;top:"&amp;table_y+30+(i-1)*tb_height&amp;"px;width:60px;height:"&amp;tb_height&amp;"px;z-index:1'>"
' response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>"&amp;formatnumber(total(i,1)*100/totalpie,2,-1)&amp;"%</td></tr></table></v:textbox></v:shape>"
next
end if
if table_type="B" then
pie=3.14159265358979
TempPie=0
for i=1 to total_no
TempAngle=pie*2*(total(i,1)/(TotalPie*2)+TempPie)
x1=table_x+all_width/2+cos(TempAngle)*all_width*3/8
y1=table_y+all_height/2-sin(TempAngle)*all_height*3/8
x2=table_x+all_width/2+cos(TempAngle)*all_width*3/4
y2=table_y+all_height/2-sin(TempAngle)*all_height*3/4
if x2>table_x+all_width/2 then
x3=x2+20
x4=x3
else
x3=x2-20
x4=x3-100
end if
response.write "<v:oval id='_x0000_s1027' style='position:absolute;left:"&amp;x1-2&amp;"px;top:"&amp;y1-2&amp;"px;width:4px;height:4px;
z-index:2' fillcolor='#111111' strokecolor='#111111'/>"&amp;CHR(13)
response.write "<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='"&amp;x1&amp;"px,"&amp;y1&amp;"px' to='"&amp;x2&amp;"px,"&amp;y2&amp;"px' coordsize='21600,21600' strokecolor='#111111' strokeweight='1px'></v:line>"
response.write "<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='"&amp;x2&amp;"px,"&amp;y2&amp;"px' to='"&amp;x3&amp;"px,"&amp;y2&amp;"px' coordsize='21600,21600' strokecolor='#111111' strokeweight='1px'></v:line>"
response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&amp;x4&amp;"px;top:"&amp;y2-10&amp;"px;width:100px;height:20px;z-index:1'>"
response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>"&amp;total(i,0)&amp;" "&amp;formatnumber(total(i,1)*100/totalpie,2,-1)&amp;"%</td></tr></table></v:textbox></v:shape>"
TempPie=TempPie+total(i,1)/TotalPie
next
end if
end function
%>

<%dim total(7,1)
total(1,0)="中国经营报"
total(2,0)="招聘网"
total(3,0)="51Job"
total(4,0)="新民晚报"
total(5,0)="新闻晚报"
total(6,0)="南方周末"
total(7,0)="羊城晚报"
total(1,1)=200
total(2,1)=1200
total(3,1)=900
total(4,1)=600
total(5,1)=1222
total(6,1)=413
total(7,1)=800
%><html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<!--[if !mso]>
<style>
v/:* { behavior: url(#default#VML) }
o/:* { behavior: url(#default#VML) }
.shape { behavior: url(#default#VML) }
</style>
<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=gb2312">
<title></title>
<style>
TD { FONT-SIZE: 9pt}
</style></head>
<body topmargin=5 leftmargin=0 scroll=AUTO>
范例一
<%call table3(total,100,40,250,250,"A")%>
<Br><Br><Br><Br><Br><Br><Br><Br><Br><Br><Br><Br><Br><Br><Br><Br><Br><Br><Br><Br>范例二
<%call table3(total,300,450,250,250,"B")%>
</body>
</html>

范例代码
<%
function table3(total,table_x,table_y,all_width,all_height,table_type)
'参数含义(传递的数组,横坐标,纵坐标,图表的宽度,图表的高度,图表的类型)
'纯ASP代码生成图表函数3--饼图
'作者:龚鸣(Passwordgm) QQ:25968152 MSN:passwordgm@sina.com Email:passwordgm@sina.com
'本人非常愿意和ASP,VML,FLASH的爱好者在HTTP://topclouds.126.com进行交流和探讨
'版本1.0 最后修改日期 2003-8-11
'非常感谢您使用这个函数,请您使用和转载时保留版权信息,这是对作者工作的最好的尊重。
tb_height=30
dim tb_color(7,2)
tb_color(1,1)="#d1ffd1"
tb_color(2,1)="#ffbbbb"
tb_color(3,1)="#ffe3bb"
tb_color(4,1)="#cff4f3"
tb_color(5,1)="#d9d9e5"
tb_color(6,1)="#ffc7ab"
tb_color(7,1)="#ecffb7"
tb_color(1,2)="#00ff00"
tb_color(2,2)="#ff0000"
tb_color(3,2)="#ff9900"
tb_color(4,2)="#33cccc"
tb_color(5,2)="#666699"
tb_color(6,2)="#993300"
tb_color(7,2)="#99cc00"
total_no=ubound(total,1)
totalpie=0
for i=1 to total_no
totalpie=totalpie+total(i,1)
next
PreAngle=0
for i=1 to total_no
response.write "<v:shape id='_x0000_s1025' alt='' style='position:absolute;left:"&amp;table_x&amp;"px;top:"&amp;table_y&amp;"px;width:"&amp;all_width&amp;"px;height:"&amp;all_height&amp;"px;z-index:1' coordsize='1500,1400' o:spt='100' adj='0,,0' path='m750,700ae750,700,750,700,"&amp;int(23592960*PreAngle)&amp;","&amp;int(23592960*total(i,1)/totalpie)&amp;"xe' fillcolor='"&amp;tb_color(i,1)&amp;"' strokecolor='#FFFFFF'><v:fill color2='"&amp;tb_color(i,2)&amp;"' rotate='t' focus='100%' type='gradient'/><v:stroke joinstyle='round'/><v:formulas/><v:path o:connecttype='segments'/></v:shape>"&amp;CHr(13)
PreAngle=PreAngle+total(i,1)/totalpie
next
if table_type="A" then
response.write "<v:rect id='_x0000_s1025' style='position:absolute;left:"&amp;table_x+all_width+20&amp;"px;top:"&amp;table_y+20&amp;"px;width:100px;height:"&amp;total_no*tb_height+20&amp;"px;z-index:1'/>"
for i=1 to total_no
response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&amp;table_x+all_width+25&amp;"px;top:"&amp;table_y+30+(i-1)*tb_height&amp;"px;width:60px;height:"&amp;tb_height&amp;"px;z-index:1'>"
response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>"&amp;total(i,0)&amp;"</td></tr></table></v:textbox></v:shape>"
response.write "<v:rect id='_x0000_s1040' alt='' style='position:absolute;left:"&amp;table_x+all_width+80&amp;"px;top:"&amp;table_y+30+(i-1)*tb_height+3&amp;"px;width:30px;height:20px;z-index:1' fillcolor='"&amp;tb_color(i,1)&amp;"'><v:fill color2='"&amp;tb_color(i,2)&amp;"' rotate='t' focus='100%' type='gradient'/></v:rect>"
'显示比例数
' response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&amp;table_x+all_width+110&amp;"px;top:"&amp;table_y+30+(i-1)*tb_height&amp;"px;width:60px;height:"&amp;tb_height&amp;"px;z-index:1'>"
' response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>"&amp;formatnumber(total(i,1)*100/totalpie,2,-1)&amp;"%</td></tr></table></v:textbox></v:shape>"
next
end if
if table_type="B" then
pie=3.14159265358979
TempPie=0
for i=1 to total_no
TempAngle=pie*2*(total(i,1)/(TotalPie*2)+TempPie)
x1=table_x+all_width/2+cos(TempAngle)*all_width*3/8
y1=table_y+all_height/2-sin(TempAngle)*all_height*3/8
x2=table_x+all_width/2+cos(TempAngle)*all_width*3/4
y2=table_y+all_height/2-sin(TempAngle)*all_height*3/4
if x2>table_x+all_width/2 then
x3=x2+20
x4=x3
else
x3=x2-20
x4=x3-100
end if
response.write "<v:oval id='_x0000_s1027' style='position:absolute;left:"&amp;x1-2&amp;"px;top:"&amp;y1-2&amp;"px;width:4px;height:4px;
z-index:2' fillcolor='#111111' strokecolor='#111111'/>"&amp;CHR(13)
response.write "<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='"&amp;x1&amp;"px,"&amp;y1&amp;"px' to='"&amp;x2&amp;"px,"&amp;y2&amp;"px' coordsize='21600,21600' strokecolor='#111111' strokeweight='1px'></v:line>"
response.write "<v:line id='_x0000_s1025' alt='' style='position:absolute;left:0;text-align:left;top:0;z-index:1' from='"&amp;x2&amp;"px,"&amp;y2&amp;"px' to='"&amp;x3&amp;"px,"&amp;y2&amp;"px' coordsize='21600,21600' strokecolor='#111111' strokeweight='1px'></v:line>"
response.write "<v:shape id='_x0000_s1025' type='#_x0000_t202' alt='' style='position:absolute;left:"&amp;x4&amp;"px;top:"&amp;y2-10&amp;"px;width:100px;height:20px;z-index:1'>"
response.write "<v:textbox inset='0px,0px,0px,0px'><table cellspacing='3' cellpadding='0' width='100%' height='100%'><tr><td align='left'>"&amp;total(i,0)&amp;" "&amp;formatnumber(total(i,1)*100/totalpie,2,-1)&amp;"%</td></tr></table></v:textbox></v:shape>"
TempPie=TempPie+total(i,1)/TotalPie
next
end if
end function
%>
发一封信给我,我发给你我有的全部资料.包括饼图,折线图,柱图.
ld@ewang.net.cn
 
to ydjjld:
你好,太感谢你在大富翁网回复我的帖子,对你的帮助我无比感激。我看了你的演示实
例,非常棒,竟然可以不用组件画出这么棒的饼图,我都不敢相信。
听说你还有柱状图的代码,我想也看看,无论如何,非常感谢你对我的帮助,热切期盼
你的恢复,谢谢。

这个是我的邮件地址:fush@163.com
futao@mail.datang.com

另:请两个邮箱都发一分,我怕收不到你的回复,谢谢!
怎么突然想起周星池《食神》片里最后那个评判的一句话:
世上还有这么好吃的叉烧饭。(满眼热泪盈眶......)
 
问题解决了,测试结果,无组件,速度快,画面质量好,强烈推荐大家使用ydjjld提供的方法,我在这里拜谢了。[:D]
 
多谢xanadu兄,我们多交流.
 
后退
顶部