在窗体上加入TeeChart控件,并通过属性加入4个TLineSeries,分别命名为Series1,Series2,Series3,Series4,并添加一按钮Button1,其Click事件为:
procedure TForm1.Button1Click(Sender:TObject);
begin
Series1.FillSampleValues(200);
Series2.FillSampleValues(200);
Series3.FillSampleValues(200);
Series4.FillSampleValues(200);
with chart1.LeftAxis do
begin
startPosition :=0;
EndPosition :=25;
Axis.Color:=clRed;
end;
Axis1 :=TChartAxis.Create(Chart1);
with Axis1 do
begin
startPosition :=25;
EndPosition :=50;
Axis.Color :=clGreen;
end;
Series2.CustomVertAxis :=Axis1;
Axis2 :=TChartAxis.Create(chart1);
with Axis2 do
begin
startPosition :=50;
EndPosition :=75;
Axis.Color :=clBlue;
end;
Series3.CustomVertAxis :=Axis2;
Axis3 :=TChartAxis.Create(chart1);
with Axis3 do
begin
startPosition :=75;
EndPosition :=100;
Axis.Color :=clYellow;
end;
Series4.CustomVertAxis :=Axis3;
end;
TSeries.Mark属性,为每个Series point的提示,可以为预定义值,如:smsLabelValue(顶点值)
TSeries.Title为右边标签框中的文本
TSeries.Legend为容纳TSeries.Title的容器