请问如何在Tchart中绘制带有一定弧度的曲线,两点确定一条直线,我想知道怎样在两点间绘制一条带弧度的曲线
解决方案 »
- C++dll delphi静态调用 单独一个unsigned?
- TreeView1.Selected.Delete 后 PopupMenu弹不出来 有点好几次右键才出来 这是啥回事?
- dbgrid无法打开datamodule中adoquery的数据库
- 找人,IM或者P2P软件开发人员,北京~
- 如何使用自定义函数与过程?
- 存储过程问题 急急急急!!!!!!!
- 明天要交活了,RAVE的报表还没做出来,帮忙呀!!!!
- 关于Unit单元中Uses部分得问题:)
- 网页开发用ASP.NET,C/S开发用DELPHI是不是计算机学生的首选
- <<<<<相信pop高手肯定遇到过这个问题。
- 文件重命名...
- TMemo控件如何显示滚动条
procedure TDrawForm.FormCreate(Sender: TObject);
begin
Percent:=50; { <-- used for this demo only }
LineSeries1.FillSampleValues(20);
end;procedure TDrawForm.LineSeries1BeforeDrawValues(Sender: TObject);
Const
MyColors:array[1..5] of TColor=
( clNavy,
clGreen,
clYellow,
clRed,
$00000080 { very red }
);
var t,partial:Longint;
tmpRect:TRect;
YPosition:Longint;
tmpYCenterValue:Double;
begin
With Chart1 do
Begin
{ we will divide the total chart width by 5 }
tmpRect:=ChartRect;
tmpRect.Right:=tmpRect.Left;
partial:=ChartWidth div 5; { change the brush style }
Canvas.Brush.Style:=bsDiagCross;
Canvas.Pen.Style:=psClear; { for each section, fill with a specific color }
for t:=1 to 5 do
Begin
{ adjust the rectangle dimension }
tmpRect.Right :=tmpRect.Right+partial+1 ; { set the brush color }
Canvas.Brush.Color:=MyColors[t]; { paint !!! }
With tmpRect do
Canvas.Rectangle( Left+Width3D,Top-Height3D,Right+Width3D,Bottom-Height3D ); { adjust rectangle }
tmpRect.Left:=tmpRect.Right;
end; { first calculate the middle vertical value (based on LineSeries points) }
With LineSeries1.YValues do
tmpYCenterValue:=MinValue+Percent*(MaxValue-MinValue)/100.0; { then calculate the Screen Pixel coordinate of the above value }
YPosition:=LeftAxis.CalcYPosValue(tmpYCenterValue); With Canvas do
begin
{ change pen and draw the line }
Pen.Width:=3;
Pen.Style:=psSolid;
Pen.Color:=clRed;
MoveTo(ChartRect.Left,YPosition);
LineTo(ChartRect.Left+Width3D,YPosition-Height3D);
LineTo(ChartRect.Right+Width3D,YPosition-Height3D);
end;
end;
end;procedure TDrawForm.LineSeries1AfterDrawValues(Sender: TObject);
Var YPosition:Longint;
tmpYCenterValue:Double;
begin
With Chart1,Canvas do
Begin
{ first calculate the middle vertical value (based on LineSeries points) }
With LineSeries1.YValues do
tmpYCenterValue:=MinValue+Percent*(MaxValue-MinValue)/100.0; { then calculate the Screen Pixel coordinate of the above value }
YPosition:=LeftAxis.CalcYPosValue(tmpYCenterValue); { change pen and draw the line }
Pen.Width:=3;
Pen.Style:=psSolid;
Pen.Color:=clRed;
MoveTo(ChartRect.Left,YPosition);
LineTo(ChartRect.Right,YPosition);
LineTo(ChartRect.Right+Width3D,YPosition-Height3D); { change font and draw some text above the line } Font.Name:='Arial'; { VERY IMPORTANT !!!!!! }
{ THIS IS NECESSARY IF YOU'RE GOING TO PRINT !!!! }
{ IT MAKES FONT SIZES TO WORK FINE BOTH AT SCREEN AND PRINTER. } Font.Height:=-24; { <-- express font size in "Height", NOT "Size" } Font.Color:=clYellow;
Font.Style:=[fsBold]; { Set transparent background... }
Brush.Style:=bsClear; { Output some text... }
TextOut( ChartRect.Left+20,
YPosition-24 ,
'This is '+FloatToStr(tmpYCenterValue));
end;
end;