在delphi中,如何实现输入二维数组,在tchart中显示一条曲线,有哪位高手编个程序我参考一下啊
展开全部
程序中加入一个Tchart控件,然后再uses中加入 Series,按钮响应如下
procedure TForm1.BitBtn2Click(Sender: TObject);
const
sarray: array[0..1] of array[0..4] of double =
((14, 4, 13, 1, 2),(15, 1, 8, 14, 6));
var
LineSeries:TLineSeries;
I:integer;
begin
tchart1.Color:=ClWhite;
tchart1.BevelOuter:=BvNone;
tchart1.Legend.Visible:=False;
LineSeries:=TLineSeries.Create(tchart1);
LineSeries.ParentChart:=tchart1;
LineSeries.ShowInLegend:=False;
LineSeries.Marks.Style:=Smsvalue;
Randomize;
tchart1.SeriesList.Clear;
For I:=0 To 4 Do
LineSeries.AddXY(sarray[0][I],sarray[1][I]);
// LineSeries.Add(Strtofloat(Value1.Strings[I]),StringReplace(Str1.Strings[I] ,'_','',[RfReplaceAll]),clTeeColor);
tchart1.SeriesList.Add(LineSeries);
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
const
sarray: array[0..1] of array[0..4] of double =
((14, 4, 13, 1, 2),(15, 1, 8, 14, 6));
var
LineSeries:TLineSeries;
I:integer;
begin
tchart1.Color:=ClWhite;
tchart1.BevelOuter:=BvNone;
tchart1.Legend.Visible:=False;
LineSeries:=TLineSeries.Create(tchart1);
LineSeries.ParentChart:=tchart1;
LineSeries.ShowInLegend:=False;
LineSeries.Marks.Style:=Smsvalue;
Randomize;
tchart1.SeriesList.Clear;
For I:=0 To 4 Do
LineSeries.AddXY(sarray[0][I],sarray[1][I]);
// LineSeries.Add(Strtofloat(Value1.Strings[I]),StringReplace(Str1.Strings[I] ,'_','',[RfReplaceAll]),clTeeColor);
tchart1.SeriesList.Add(LineSeries);
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询