一个网页中的chart例子(1)

  • 主题发起人 主题发起人 wangminqi
  • 开始时间 开始时间
W

wangminqi

Unregistered / Unconfirmed
GUEST, unregistred user!
unit UClinetWebChart;{$WARN SYMBOL_PLATFORM OFF}interfaceuses ComObj, ActiveX, AspTlb, PClinetWebChart_TLB, StdVcl,TeeProcs, TeEngine, Chart, TeeShape, GanttCh, BubbleCh, Series,StrUtils,SysUtils,Graphics,Classes,variants,uGlobal;const GB2312_CHARSET = 134;type TClinetWebChart = class(TASPObject, IClinetWebChart) protected procedure OnEndPage;
safecall;
procedure OnStartPage(const AScriptingContext: IUnknown);
safecall;
procedure GetChart;
safecall;
procedure Set_ChartHight(Value: Integer);
safecall;
procedure Set_ChartWidth(Value: Integer);
safecall;
procedure Set_View3D(Value: Integer);
safecall;
procedure Set_ChartTitle(const Value: WideString);
safecall;
procedure Set_LegendVisible(Value: Integer);
safecall;
procedure AddSeries(Value, sColor: Integer);
safecall;
procedure SeriesAddXY(SeriesPos: Integer;
X, Y:do
uble;
const pLabel: WideString;
pColor: Integer);
safecall;
procedure SeriesHorizAxis(SeriesPos, aAxis: Integer);
safecall;
procedure SeriesVertAxis(SeriesPos, aAxis: Integer);
safecall;
procedure Set_BottomAxisMax(Value:do
uble);
safecall;
procedure Set_BottomAxisMin(Value:do
uble);
safecall;
procedure Set_BottomAxisTitle(const Value: WideString);
safecall;
procedure Set_LeftAxisMax(Value:do
uble);
safecall;
procedure Set_LeftAxisMin(Value:do
uble);
safecall;
procedure Set_LeftAxisTitle(const Value: WideString);
safecall;
procedure Set_RightAxisMax(Value:do
uble);
safecall;
procedure Set_RightAxisMin(Value:do
uble);
safecall;
procedure Set_RightAxisTitle(const Value: WideString);
safecall;
procedure Set_TopAxisMax(Value:do
uble);
safecall;
procedure Set_TopAxisMin(Value:do
uble);
safecall;
procedure Set_TopAxisTitle(const Value: WideString);
safecall;
procedure SeriesClear;
safecall;
procedure SeriesAddX(SeriesPos: Integer;
X:do
uble;
const pLabel: WideString;
pColor: Integer);
safecall;
procedure SeriesAddY(SeriesPos: Integer;
Y:do
uble;
const pLabel: WideString;
pColor: Integer);
safecall;
procedure SeriesMarksVisible(SeriesPos, Value: Integer);
safecall;
end;
implementationuses ComServ;procedure TClinetWebChart.OnEndPage;
begin
inherited OnEndPage;
end;
procedure TClinetWebChart.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
Session.Value['ChartHight']:='';
Session.Value['ChartWidth']:='';
Session.Value['View3D']:='';
Session.Value['ChartTitle']:='';
Session.Value['LegendVisible']:='';
Session.Value['AddSeries']:='';
Session.Value['SeriesAddXY']:='';
Session.Value['SeriesHorizAxis']:='';
Session.Value['SeriesVertAxis']:='';
Session.Value['BottomAxisMax']:='';
Session.Value['BottomAxisMin']:='';
Session.Value['BottomAxisTitle']:='';
Session.Value['LeftAxisMax']:='';
Session.Value['LeftAxisMin']:='';
Session.Value['LeftAxisTitle']:='';
Session.Value['RightAxisMax']:='';
Session.Value['RightAxisMin']:='';
Session.Value['RightAxisTitle']:='';
Session.Value['TopAxisMax']:='';
Session.Value['TopAxisMin']:='';
Session.Value['TopAxisTitle']:='';
Session.Value['SeriesClear']:='';
Session.Value['SeriesAddX']:='';
Session.Value['SeriesAddY']:='';
Session.Value['SeriesMarksVisible']:='';
end;
procedure TClinetWebChart.GetChart;var bmp1:olevariant;
filename:string;
s:string;
l,j:integer;
p:pointer;
bmp:TBitmap;
pStream:TMemoryStream;
pChart:Tchart;
achartSeries:TChartSeries;
myList,myList1:TMyStringList;
begin
{Response.Write('ChartHight:'+vartostr(Session.Value['ChartHight'])+'
');Response.Write('ChartWidth:'+vartostr(Session.Value['ChartWidth'])+'
');Response.Write('View3D:'+vartostr(Session.Value['View3D'])+'
');Response.Write('ChartTitle:'+vartostr(Session.Value['ChartTitle'])+'
');Response.Write('LegendVisible:'+vartostr(Session.Value['LegendVisible'])+'
');Response.Write('BottomAxisMax:'+vartostr(Session.Value['BottomAxisMax'])+'
');Response.Write('BottomAxisMin:'+vartostr(Session.Value['BottomAxisMin'])+'
');Response.Write('BottomAxisTitle:'+vartostr(Session.Value['BottomAxisTitle'])+'
');Response.Write('LeftAxisMax:'+vartostr(Session.Value['LeftAxisMax'])+'
');Response.Write('LeftAxisMin:'+vartostr(Session.Value['LeftAxisMin'])+'
');Response.Write('LeftAxisTitle:'+vartostr(Session.Value['LeftAxisTitle'])+'
');Response.Write('RightAxisMax:'+vartostr(Session.Value['RightAxisMax'])+'
');Response.Write('RightAxisMin:'+vartostr(Session.Value['RightAxisMin'])+'
');Response.Write('RightAxisTitle:'+vartostr(Session.Value['RightAxisTitle'])+'
');Response.Write('TopAxisMax:'+vartostr(Session.Value['TopAxisMax'])+'
');Response.Write('TopAxisMin:'+vartostr(Session.Value['TopAxisMin'])+'
');Response.Write('TopAxisTitle:'+vartostr(Session.Value['TopAxisTitle'])+'
');Response.Write('SeriesClear:'+vartostr(Session.Value['SeriesClear'])+'
');Response.Write('AddSeries:'+vartostr(Session.Value['AddSeries'])+'
');Response.Write('SeriesMarksVisible:'+vartostr(Session.Value['SeriesMarksVisible'])+'
');Response.Write('SeriesHorizAxis:'+vartostr(Session.Value['SeriesHorizAxis'])+'
');Response.Write('SeriesVertAxis:'+vartostr(Session.Value['SeriesVertAxis'])+'
');Response.Write('SeriesAddX:'+vartostr(Session.Value['SeriesAddX'])+'
');Response.Write('SeriesAddY:'+vartostr(Session.Value['SeriesAddY'])+'
');Response.Write('SeriesAddXY:'+vartostr(Session.Value['SeriesAddXY'])+'
');} pChart:=Tchart.Create(nil);
pChart.Canvas.Font.Charset := GB2312_CHARSET;
pChart.Canvas.Font.Name :='宋体';
pChart.LeftAxis.Automatic:=true;
pChart.LeftAxis.AutomaticMaximum :=true;
pChart.LeftAxis.AutomaticMinimum :=true;
pChart.BottomAxis.Automatic:=true;
pChart.BottomAxis.AutomaticMaximum :=true;
pChart.BottomAxis.AutomaticMinimum :=true;
pChart.RightAxis.Automatic:=true;
pChart.RightAxis.AutomaticMaximum :=true;
pChart.RightAxis.AutomaticMinimum :=true;
pChart.TopAxis.Automatic:=true;
pChart.TopAxis.AutomaticMaximum :=true;
pChart.TopAxis.AutomaticMinimum :=true;
pChart.Title.Font.Charset :=GB2312_CHARSET;
pChart.Title.Font.Name :='宋体';
pChart.RightAxis.Title.Font.Charset :=GB2312_CHARSET;
pChart.RightAxis.Title.Font.Name :='宋体';
pChart.LeftAxis.Title.Font.Charset :=GB2312_CHARSET;
pChart.LeftAxis.Title.Font.Name :='宋体';
pChart.TopAxis.Title.Font.Charset :=GB2312_CHARSET;
pChart.TopAxis.Title.Font.Name :='宋体';
pChart.BottomAxis.Title.Font.Charset :=GB2312_CHARSET;
pChart.BottomAxis.Title.Font.Name :='宋体';
pChart.Legend.
Font.Charset :=GB2312_CHARSET;
pChart.Legend.
Font.Name :='宋体';
//1 if trim(vartostr(Session.Value['ChartHight']))<>'' then
pChart.Height :=Session.Value['ChartHight'];
//2 if trim(vartostr(Session.Value['ChartWidth'])) <>'' then
pChart.Width :=Session.Value['ChartWidth'];
//3 if trim(vartostr(Session.Value['View3D']))<>'' then
begin
if Session.Value['View3D']=1 then
pChart.View3D:=true else
pChart.View3D :=false;
end;
//4 if trim(vartostr(Session.Value['ChartTitle']))<>'' then
pChart.Title.Text.Text:=Session.Value['ChartTitle'];
//5 if trim(vartostr(Session.Value['LegendVisible']))<>'' then
begin
if Session.Value['LegendVisible']=1 then
pChart.Legend.
Visible :=true else
pChart.Legend.
Visible :=false;
end;
//6 if trim(vartostr(Session.Value['BottomAxisMax']))<>'' then
begin
pChart.BottomAxis.Automatic:=false;
pChart.BottomAxis.AutomaticMaximum :=false;
pChart.BottomAxis.Maximum :=Session.Value['BottomAxisMax'];
end;
//7 if trim(vartostr(Session.Value['BottomAxisMin']))<>'' then
begin
pChart.BottomAxis.Automatic:=false;
pChart.BottomAxis.AutomaticMinimum :=false;
pChart.BottomAxis.Minimum :=Session.Value['BottomAxisMin'];
end;
//8 if trim(vartostr(Session.Value['BottomAxisTitle']))<>'' then
pChart.BottomAxis.Title.Caption :=Session.Value['BottomAxisTitle'];
//9 if trim(vartostr(Session.Value['LeftAxisMax']))<>'' then
begin
pChart.LeftAxis.Automatic:=false;
pChart.LeftAxis.AutomaticMaximum :=false;
pChart.LeftAxis.Maximum :=Session.Value['LeftAxisMax'];
end;
//10 if trim(vartostr(Session.Value['LeftAxisMin']))<>'' then
begin
pChart.LeftAxis.Automatic:=false;
pChart.LeftAxis.AutomaticMinimum :=false;
pChart.LeftAxis.Minimum :=Session.Value['LeftAxisMin'];
end;
//11 if trim(vartostr(Session.Value['LeftAxisTitle']))<>'' then
pChart.LeftAxis.Title.Caption :=Session.Value['LeftAxisTitle'];
//12 if trim(vartostr(Session.Value['RightAxisMax']))<>'' then
begin
pChart.RightAxis.Automatic:=false;
pChart.RightAxis.AutomaticMaximum :=false;
pChart.RightAxis.Maximum :=Session.Value['RightAxisMax'];
end;
//13 if trim(vartostr(Session.Value['RightAxisMin']))<>'' then
begin
pChart.RightAxis.Automatic:=false;
pChart.RightAxis.AutomaticMinimum :=false;
pChart.RightAxis.Minimum :=Session.Value['RightAxisMin'];
end;
//14 if trim(vartostr(Session.Value['RightAxisTitle']))<>'' then
pChart.RightAxis.Title.Caption :=Session.Value['RightAxisTitle'];
//15 if trim(vartostr(Session.Value['TopAxisMax']))<>'' then
begin
pChart.TopAxis.Automatic:=false;
pChart.TopAxis.AutomaticMaximum :=false;
pChart.TopAxis.Maximum :=Session.Value['TopAxisMax'];
end;
//16 if trim(vartostr(Session.Value['TopAxisMin']))<>'' then
begin
pChart.TopAxis.Automatic:=false;
pChart.TopAxis.AutomaticMinimum :=false;
pChart.TopAxis.Minimum :=Session.Value['TopAxisMin'];
end;
//17 if trim(vartostr(Session.Value['TopAxisTitle']))<>'' then
pChart.TopAxis.Title.Caption :=Session.Value['TopAxisTitle'];
//18 if trim(vartostr(Session.Value['SeriesClear']))<>'' then
begin
for j := pChart.SeriesCount - 1do
wnto 0do
begin
pChart.SeriesList[j].Free;
end;
end;
//19 if trim(vartostr(Session.Value['AddSeries']))<>'' then
begin
achartSeries:=nil;
myList:=TMyStringList.Create;
myList.Delimiter :=';';
myList.MyDelimitedText :=Session.Value['AddSeries'];
for j:=0 to myList.Count -1do
begin
myList1:=TMyStringList.Create;
myList1.Delimiter :=',';
myList1.MyDelimitedText :=myList.Strings[j];
if myList1.Count >1 then
begin
if trim(myList1.Strings[0])<>'' then
case strtoint(myList1.Strings[0]) of 1: achartSeries:=TLineSeries.Create(nil);
2: achartSeries:= TBarSeries.Create(nil);
3: achartSeries:= THorizBarSeries.Create(nil);
4: achartSeries:= TAreaSeries.Create(nil);
5: achartSeries:= TPointSeries.Create(nil);
6: achartSeries:= TPieSeries.Create(nil);
7: achartSeries:= TFastLineSeries.Create(nil);
8: achartSeries:= THorizLineSeries.Create(nil);
9: achartSeries:= THorizAreaSeries.Create(nil);
10: achartSeries:= TBubbleSeries.Create(nil);
11: achartSeries:= TGanttSeries.Create(nil);
12: achartSeries:= TChartShape.Create(nil);
end;
achartSeries.Color:=strtoint(myList1.Strings[1]);
pChart.AddSeries(achartSeries);
end;
myList1.Free;
end;
myList.Free;
end;
//20 if trim(vartostr(Session.Value['SeriesHorizAxis']))<>'' then
begin
myList:=TMyStringList.Create;
myList.Delimiter :=';';
myList.MyDelimitedText :=Session.Value['SeriesHorizAxis'];
for j:=0 to myList.Count -1do
begin
myList1:=TMyStringList.Create;
myList1.Delimiter :=',';
myList1.MyDelimitedText :=myList.Strings[j];
if myList1.Count >1 then
begin
if strtoint(myList1.Strings[1])=0 then
pChart.Series[strtoint(myList1.Strings[0])].HorizAxis :=aBottomAxis else
pChart.Series[strtoint(myList1.Strings[0])].HorizAxis :=aTopAxis;
end;
myList1.Free;
end;
myList.Free;
end;
//21 if trim(vartostr(Session.Value['SeriesVertAxis']))<>'' then
begin
myList:=TMyStringList.Create;
myList.Delimiter :=';';
myList.MyDelimitedText :=Session.Value['SeriesVertAxis'];
for j:=0 to myList.Count -1do
begin
myList1:=TMyStringList.Create;
myList1.Delimiter :=',';
myList1.MyDelimitedText :=myList.Strings[j];
if myList1.Count >1 then
begin
if strtoint(myList1.Strings[1])=0 then
pChart.Series[strtoint(myList1.Strings[0])].VertAxis :=aLeftAxis else
pChart.Series[strtoint(myList1.Strings[0])].VertAxis :=aRightAxis;
end;
myList1.Free;
end;
myList.Free;
end;
//22 if trim(vartostr(Session.Value['SeriesMarksVisible']))<>'' then
begin
myList:=TMyStringList.Create;
myList.Delimiter :=';';
myList.MyDelimitedText :=Session.Value['SeriesMarksVisible'];
for j:=0 to myList.Count -1do
begin
myList1:=TMyStringList.Create;
myList1.Delimiter :=',';
myList1.MyDelimitedText :=myList.Strings[j];
if myList1.Count >1 then
begin
if strtoint(myList1.Strings[1])=1 then
pChart.Series[strtoint(myList1.Strings[0])].Marks.visible:=true else
pChart.Series[strtoint(myList1.Strings[0])].Marks.visible:=false;
end;
myList1.Free;
end;
myList.Free;
end;
//23 if trim(vartostr(Session.Value['SeriesAddXY']))<>'' then
begin
myList:=TMyStringList.Create;
myList.Delimiter :=';';
myList.MyDelimitedText :=Session.Value['SeriesAddXY'];
for j:=0 to myList.Count -1do
begin
myList1:=TMyStringList.Create;
myList1.Delimiter :=',';
myList1.MyDelimitedText :=myList.Strings[j];
if myList1.Count >4 then
begin
if strtoint(myList1.Strings[4])>0 then
pChart.Series[strtoint(myList1.Strings[0])].AddXY( strtofloat(myList1.Strings[1]),strtofloat(myList1.Strings[2]), trim(myList1.Strings[3]),strtoint(myList1.Strings[4])) else
pChart.Series[strtoint(myList1.Strings[0])].AddXY( strtofloat(myList1.Strings[1]),strtofloat(myList1.Strings[2]), trim(myList1.Strings[3]));
end;
myList1.Free;
end;
myList.Free;
end;
//24 if trim(vartostr(Session.Value['SeriesAddX']))<>'' then
begin
myList:=TMyStringList.Create;
myList.Delimiter :=';';
myList.MyDelimitedText :=Session.Value['SeriesAddX'];
for j:=0 to myList.Count -1do
begin
myList1:=TMyStringList.Create;
myList1.Delimiter :=',';
myList1.MyDelimitedText :=myList.Strings[j];
if myList1.Count >3 then
begin
if strtoint(myList1.Strings[3])>0 then
pChart.Series[strtoint(myList1.Strings[0])].AddX( strtofloat(myList1.Strings[1]),trim(myList1.Strings[2]), strtoint(myList1.Strings[3])) else
pChart.Series[strtoint(myList1.Strings[0])].AddX( strtofloat(myList1.Strings[1]),trim(myList1.Strings[2]));
end;
myList1.Free;
end;
myList.Free;
end;
//25 if trim(vartostr(Session.Value['SeriesAddY']))<>'' then
begin
myList:=TMyStringList.Create;
myList.Delimiter :=';';
myList.MyDelimitedText :=Session.Value['SeriesAddY'];
for j:=0 to myList.Count -1do
begin
myList1:=TMyStringList.Create;
myList1.Delimiter :=',';
myList1.MyDelimitedText :=myList.Strings[j];
if myList1.Count >3 then
begin
if strtoint(myList1.Strings[3])>0 then
pChart.Series[strtoint(myList1.Strings[0])].AddY( strtofloat(myList1.Strings[1]),trim(myList1.Strings[2]), strtoint(myList1.Strings[3])) else
pChart.Series[strtoint(myList1.Strings[0])].AddY( strtofloat(myList1.Strings[1]),trim(myList1.Strings[2]));
end;
myList1.Free;
end;
myList.Free;
end;
pStream:=nil;
bmp:=nil;
try Response.ContentType:='image/bmp';
s:=formatdatetime('yyyymmddhhnnsszzz'+Session.SessionID,now);
filename:=Server.MapPath('.');
if rightstr(filename,1)<>'/' then
filename:=filename+'/';
pChart.SaveToBitmapFile(filename+s+'.bmp');
bmp:=TBitmap.Create;
bmp.LoadFromFile(filename+s+'.bmp');
pStream:=TMemoryStream.Create;
bmp.SaveToStream(pStream);
l:=pStream.Size;
bmp1:=varArrayCreate([0,l-1],varByte);//创建variant数组 p:=VarArrayLock(bmp1);
pStream.Seek(0,soFrombegin
ning);
pStream.Read(p^,l);
vararrayunlock(bmp1);
Response.BinaryWrite(bmp1);
finally pStream.free;
Response.BinaryWrite(bmp1);
bmp.Free;
DeleteFile(filename+s+'.bmp');
end;
end;
procedure TClinetWebChart.Set_ChartHight(Value: Integer);
begin
Session.Value['ChartHight']:= Value;
end;
procedure TClinetWebChart.Set_ChartWidth(Value: Integer);
begin
Session.Value['ChartWidth']:=Value;
end;
procedure TClinetWebChart.Set_View3D(Value: Integer);
begin
Session.Value['View3D']:=Value;
end;
procedure TClinetWebChart.Set_ChartTitle(const Value: WideString);
begin
Session.Value['ChartTitle']:=Value;
end;
procedure TClinetWebChart.Set_LegendVisible(Value: Integer);
begin
Session.Value['LegendVisible']:=Value;
end;
procedure TClinetWebChart.AddSeries(Value, sColor: Integer);vars:string;
begin
s:=Session.Value['AddSeries'];
if trim(s)='' then
s:=inttostr(Value)+','+floattostr(sColor) else
s:=s+';'+inttostr(Value)+','+floattostr(sColor);
Session.Value['AddSeries']:=s;
end;
procedure TClinetWebChart.SeriesAddXY(SeriesPos: Integer;
X, Y:do
uble;
const pLabel: WideString;
pColor: Integer);var s,aLabel:string;
begin
aLabel:=pLabel;
aLabel:=stringreplace(aLabel,',',',',[rfReplaceAll]);
aLabel:=stringreplace(aLabel,';',';',[rfReplaceAll]);
s:=Session.Value['SeriesAddXY'];
if trim(s)='' then
s:=inttostr(SeriesPos)+','+floattostr(X)+','+floattostr(Y)+','+aLabel+','+inttostr(pColor) else
s:=s+';'+inttostr(SeriesPos)+','+floattostr(X)+','+floattostr(Y)+','+aLabel+','+inttostr(pColor);
Session.Value['SeriesAddXY']:=s;
end;
procedure TClinetWebChart.SeriesHorizAxis(SeriesPos, aAxis: Integer);var s:string;
begin
s:=inttostr(SeriesPos)+','+inttostr(aAxis);
Session.Value['SeriesHorizAxis']:=s;
end;
procedure TClinetWebChart.SeriesVertAxis(SeriesPos, aAxis: Integer);var s:string;
begin
s:=inttostr(SeriesPos)+','+inttostr(aAxis);
Session.Value['SeriesVertAxis']:=s;
end;
procedure TClinetWebChart.Set_BottomAxisMax(Value:do
uble);
begin
Session.Value['BottomAxisMax']:=Value;
end;
procedure TClinetWebChart.Set_BottomAxisMin(Value:do
uble);
begin
Session.Value['BottomAxisMin']:=Value;
end;
procedure TClinetWebChart.Set_BottomAxisTitle(const Value: WideString);
begin
Session.Value['BottomAxisTitle']:=Value;
end;
procedure TClinetWebChart.Set_LeftAxisMax(Value:do
uble);
begin
Session.Value['LeftAxisMax']:=Value;
end;
procedure TClinetWebChart.Set_LeftAxisMin(Value:do
uble);
begin
Session.Value['LeftAxisMin']:=Value;
end;
procedure TClinetWebChart.Set_LeftAxisTitle(const Value: WideString);
begin
Session.Value['LeftAxisTitle']:=Value;
end;
procedure TClinetWebChart.Set_RightAxisMax(Value:do
uble);
begin
Session.Value['RightAxisMax']:=Value;
end;
procedure TClinetWebChart.Set_RightAxisMin(Value:do
uble);
begin
Session.Value['RightAxisMin']:=Value;
end;
procedure TClinetWebChart.Set_RightAxisTitle(const Value: WideString);
begin
Session.Value['RightAxisTitle']:=Value;
end;
procedure TClinetWebChart.Set_TopAxisMax(Value:do
uble);
begin
Session.Value['TopAxisMax']:=Value;
end;
procedure TClinetWebChart.Set_TopAxisMin(Value:do
uble);
begin
Session.Value['TopAxisMin']:=Value;
end;
procedure TClinetWebChart.Set_TopAxisTitle(const Value: WideString);
begin
Session.Value['TopAxisTitle']:=Value;
end;
procedure TClinetWebChart.SeriesClear;
begin
Session.Value['SeriesClear']:=1;
end;
procedure TClinetWebChart.SeriesAddX(SeriesPos: Integer;
X:do
uble;
const pLabel: WideString;
pColor: Integer);var s,aLabel:string;
begin
aLabel:=pLabel;
aLabel:=stringreplace(aLabel,',',',',[rfReplaceAll]);
aLabel:=stringreplace(aLabel,';',';',[rfReplaceAll]);
s:=Session.Value['SeriesAddX'];
if trim(s)='' then
s:=inttostr(SeriesPos)+','+floattostr(X)+','+aLabel+','+inttostr(pColor) else
s:=s+';'+inttostr(SeriesPos)+','+floattostr(X)+','+aLabel+','+inttostr(pColor);
Session.Value['SeriesAddX']:=s;
end;
procedure TClinetWebChart.SeriesAddY(SeriesPos: Integer;
Y:do
uble;
const pLabel: WideString;
pColor: Integer);var s,aLabel:string;
begin
aLabel:=pLabel;
aLabel:=stringreplace(aLabel,',',',',[rfReplaceAll]);
aLabel:=stringreplace(aLabel,';',';',[rfReplaceAll]);
s:=Session.Value['SeriesAddY'];
if trim(s)='' then
s:=inttostr(SeriesPos)+','+floattostr(Y)+','+aLabel+','+inttostr(pColor) else
s:=s+';'+inttostr(SeriesPos)+','+floattostr(Y)+','+aLabel+','+inttostr(pColor);
Session.Value['SeriesAddY']:=s;
end;
procedure TClinetWebChart.SeriesMarksVisible(SeriesPos, Value: Integer);var s:string;
begin
s:=inttostr(SeriesPos)+','+inttostr(Value);
Session.Value['SeriesMarksVisible']:=s;
end;
initialization TAutoObjectFactory.Create(ComServer, TClinetWebChart, Class_ClinetWebChart, ciMultiInstance, tmApartment);
end.
asp 调用此aso对象<% '创建图表对象 Set DelphiASPObj = Server.CreateObject("PClinetWebChart.ClinetWebChart") 'procedure GetChart;
safecall;
'procedure Set_ChartHight(Value: Integer);
safecall;
'procedure Set_ChartWidth(Value: Integer);
safecall;
'procedure Set_View3D(Value: Integer);
safecall;
'procedure Set_ChartTitle(const Value: WideString);
safecall;
'procedure Set_LegendVisible(Value: Integer);
safecall;
'procedure AddSeries(Value: Integer;
sColor: Int64);
safecall;
'procedure SeriesAddXY(SeriesPos: Integer;
X, Y:do
uble;
' const pLabel: WideString;
pColor: Int64);
safecall;
'procedure SeriesHorizAxis(SeriesPos, aAxis: Integer);
safecall;
'procedure SeriesVertAxis(SeriesPos, aAxis: Integer);
safecall;
'procedure Set_BottomAxisMax(Value:do
uble);
safecall;
'procedure Set_BottomAxisMin(Value:do
uble);
safecall;
'procedure Set_BottomAxisTitle(const Value: WideString);
safecall;
'procedure Set_LeftAxisMax(Value:do
uble);
safecall;
'procedure Set_LeftAxisMin(Value:do
uble);
safecall;
'procedure Set_LeftAxisTitle(const Value: WideString);
safecall;
'procedure Set_RightAxisMax(Value:do
uble);
safecall;
'procedure Set_RightAxisMin(Value:do
uble);
safecall;
'procedure Set_RightAxisTitle(const Value: WideString);
safecall;
'procedure Set_TopAxisMax(Value:do
uble);
safecall;
'procedure Set_TopAxisMin(Value:do
uble);
safecall;
'procedure Set_TopAxisTitle(const Value: WideString);
safecall;
'procedure SeriesClear;
safecall;
'设置生成图表的宽度和高度 DelphiASPObj.ChartHight=310 DelphiASPObj.ChartHight=200 '是否显示图例 DelphiASPOBJ.LegendVisible=0 '图表外观是否以3D形式显示 DelphiASPOBJ.View3D =0 '清除Series DelphiASPOBJ.SeriesClear '图表的类型: '1:TLineSeries线图 '2:TBarSeries柱状图 '3:THorizBarSeries水平柱状图 '4:TAreaSeries区域填充图 '5:TPointSeries点形图 '6:TPieSeries饼状图 '255为红色32768为绿色16711680为蓝色 DelphiASPOBJ.AddSeries 2,255 '设第一个Series的横坐标使用BottomAxis DelphiASPOBJ.SeriesHorizAxis 0,0 DelphiASPOBJ.SeriesVertAxis 0,0 '图表的纵坐标文字 DelphiASPOBj.LeftAxisTitle=" 单位:吨 " '图表的横坐标文字 DelphiASPOBJ.BottomAxisTitle="生产次数" '图表的标题 DelphiASPOBJ.ChartTitle="生产统计图" '以下AddXY方法为向图表显示的数据。 '注意:当XAxisType值为1 时,本方法的第一个参数是数字,第二个是文字 '当XAxisType值为0 时 ,本方法的第一个,第二个参数都为数字 DelphiASPObj.SeriesAddXY 0,0,0,"",-1 DelphiASPObj.SeriesAddXY 0,80,40,"",-1 DelphiASPObj.SeriesAddXY 0,160,80,"",-1 DelphiASPObj.SeriesAddXY 0,240,120,"",-1 DelphiASPObj.SeriesAddXY 0,300,200,"",-1 '获取返回的图形 DelphiASPObj.GetChart set DelphiASPObj=nothing Response.End%>
 

Similar threads

S
回复
0
查看
886
SUNSTONE的Delphi笔记
S
S
回复
0
查看
863
SUNSTONE的Delphi笔记
S
后退
顶部