delphi 如何tChart 画两条不同的线
请教各位,我已经有两条线的所有点坐标,我用的代码只是画一条线,请问怎么修改才能实现在TChart中画两条呢?我的代码如下:varLineSeries:TLineSerie...
请教各位,我已经有两条线的所有点坐标,我用的代码只是画一条线,请问怎么修改才能实现在TChart中画两条呢?我的代码如下:
var
LineSeries:TLineSeries;
i:integer;
begin
chart1.BevelOuter:=BvNone;
chart1.Legend.Visible:=False;
LineSeries:=TLineSeries.Create(chart1);
LineSeries.ParentChart:=chart1;
LineSeries.ShowInLegend:=False;
LineSeries.Marks.Style:=Smsvalue;
for i:=1 to 10 do
begin
chart1.SeriesList.Clear;
LineSeries.AddXY(X,Y);//已有所有坐标,省略为(X,Y)
chart1.SeriesList.Add(LineSeries);
end;
end; 展开
var
LineSeries:TLineSeries;
i:integer;
begin
chart1.BevelOuter:=BvNone;
chart1.Legend.Visible:=False;
LineSeries:=TLineSeries.Create(chart1);
LineSeries.ParentChart:=chart1;
LineSeries.ShowInLegend:=False;
LineSeries.Marks.Style:=Smsvalue;
for i:=1 to 10 do
begin
chart1.SeriesList.Clear;
LineSeries.AddXY(X,Y);//已有所有坐标,省略为(X,Y)
chart1.SeriesList.Add(LineSeries);
end;
end; 展开
1个回答
展开全部
LineSeries:TFastLineSeries;
i,j:integer;
x,y:real;
begin
chart1.BevelOuter:=BvNone;
chart1.Legend.Visible:=true;
chart1.RightAxis.Automatic:=true;
randomize;
for j:=0 to 1 do
begin
LineSeries:=TFastLineSeries.Create(chart1);
Chart1.AddSeries(LineSeries);
chart1.Series[j].Title:='s'+inttostr(j);
chart1.Series[j].ShowInLegend:=true;
chart1.Series[j].Marks.Style:=Smsvalue;
for i:=1 to 10 do
begin
y:= Random(100);
x:=i;
chart1.Series[j].Addxy(x,y);
end;
end;
i,j:integer;
x,y:real;
begin
chart1.BevelOuter:=BvNone;
chart1.Legend.Visible:=true;
chart1.RightAxis.Automatic:=true;
randomize;
for j:=0 to 1 do
begin
LineSeries:=TFastLineSeries.Create(chart1);
Chart1.AddSeries(LineSeries);
chart1.Series[j].Title:='s'+inttostr(j);
chart1.Series[j].ShowInLegend:=true;
chart1.Series[j].Marks.Style:=Smsvalue;
for i:=1 to 10 do
begin
y:= Random(100);
x:=i;
chart1.Series[j].Addxy(x,y);
end;
end;
追问
再请教一下
chart1.Series[0].LinePen.Width:=2
这个为什么说我没定义呢?还有我想改变线的颜色以及让每个坐标点以菱形来突出显示用代码怎么实现啊?
追答
var LineSeries:TLineSeries;
i,j:integer;
x,y:real;
begin
chart1.BevelOuter:=BvNone;
chart1.Legend.Visible:=true;
chart1.RightAxis.Automatic:=true;
randomize;
for j:=0 to 1 do
begin
LineSeries:=TLineSeries.Create(chart1);
Chart1.AddSeries(LineSeries);
chart1.Series[j].Title:='s'+inttostr(j);
chart1.Series[j].ShowInLegend:=true;
chart1.Series[j].Marks.Style:=Smsvalue;
for i:=1 to 10 do
begin
y:= Random(100);
x:=i;
chart1.Series[j].Addxy(x,y);
end;
TLineSeries(chart1.Series[j]).LinePen.Width:=2;
TLineSeries(chart1.Series[j]).Pointer.Visible:=true;
TLineSeries(chart1.Series[j]).Pointer.Style:=psDiamond;
end;
end;
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询