概述
【实例简介】读股票数据画K线图很不错的Delphi源码
【实例截图】
【核心代码】procedure TfrmMain2.DrawScaleK(C: TCanvas; R: TRect);
var
High, Low, D: Single;
HIndex, LIndex: TArrayOfInteger;
HA, LA: TArrayOfSingle;
begin
if FindKLineScaleHighLow(StkDataFile,High,Low,HA,LA,HIndex,LIndex) then
begin
ScaleHigh[1] := High;
ScaleLow[1] := Low;
D := (High-Low) / 20;
High:= High D;
Low := Low -D;
InflateRect(R,0,-2);
DRAW_SCALE(C,R,ScaleLow[1],ScaleHigh[1],Low,High,_height_(R) div 25, True);
end;
end;
procedure TfrmMain2.DrawV(C: TCanvas; R: TRect);
var
D, High, Low: Single;
I, J, X1, X2, Y1, Y2: Integer;
P: PStkDataRec;
begin
if FindVLineScaleHighLow(StkDataFile,High,Low) then
begin
ScaleHigh[2] := High;
ScaleLow[2] := Low;
D := (High-Low) / 10;
High:= High D;
InflateRect(R,0,-2);
if ShowBackgroundDotLine then DRAW_HORZ_SCALE(C,R,ScaleLow[2],ScaleHigh[2],Low,High,_height_(R) div 25, True);
_setPen_(C,GRID.Color,1,psSolid,pmCopy);
_setBrush_(C,GRID.Color,bsSolid);
for I := 0 to DataPerPage-1 do
begin
J := PageStart DataPerPage - I - 1;
P := StkDataFile.getData(J);
if P <> nil then
begin
if P^.CP > P^.OP then C.Pen.Color := clRed
else if P^.CP < P^.OP then C.Pen.Color := clAqua
else C.Pen.Color := clLime;
C.Brush.Color := C.Pen.Color;
X1 := 1 UnitWidth * I;
X2 := UnitWidth * (I 1);
Y1 := R.Bottom;
Y2 := Fy2Iy(P^.VOL,R,High,Low);
if UnitWidth > 2 then C.Rectangle(Rect(X1,Y1,X2,Y2))
else _line_(C,X1,Y1,X1,Y2);
end;
end;
if IS_DRAW_MA then
for I := 0 to Length(VMAC)-1 do
if VMAC[I] > 0 then
DrawLine(VMA[I], DEF_COLOR[I], C, R, High, Low);
end;
end;
procedure TfrmMain2.DrawRSI(C: TCanvas; R: TRect);
var
High, Low: Single;
I, Y: Integer;
begin
High := 100;
Low := 0;
ScaleHigh[3] := 100;
ScaleLow[3] := 0;
InflateRect(R,0,-2);
_setBrush_(C,GRID.Color,bsSolid);
if ShowBackgroundDotLine then
begin
_setPen_(C,clRed,1,psDot,pmCopy);
Y := Fy2Iy(80,R,High,Low); _line_(C,R.Left 1,Y,R.Right,Y,clRed);
Y := Fy2Iy(50,R,High,Low); _line_(C,R.Left 1,Y,R.Right,Y,clSilver);
Y := Fy2Iy(20,R,High,Low); _line_(C,R.Left 1,Y,R.Right,Y,clAqua);
end;
_setPen_(C,clRed,1,psSolid,pmCopy);
for I := 0 to Length(RSIC)-1 do
if RSIC[I] > 0 then
DrawLine(RSI[I], DEF_COLOR[I], C, R, High, Low);
end;
最后
以上就是聪明方盒为你收集整理的php画股票k线图,读股票数据画K线图很不错的Delphi源码的全部内容,希望文章能够帮你解决php画股票k线图,读股票数据画K线图很不错的Delphi源码所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复