프로그래밍 방식으로 tChart를 생성합니다 (Delphi2007, TeeChar 7 무료 에디션). 차트 치수를 설정하고 가로 세로 비율을 변경하고 싶지만 Width 및 Height 속성을 변경해도 의미있는 결과를 얻지 못합니다. 나는 행운과 함께 TickLength 축을 변경하려고했습니다. 나는 의미있는 것을 잊지 않고 dfm 파일에서 TChart의 관련 속성을 복사했습니다. 그래프의 양상은 X와 Y의 최대 값과 최소값을 편집 할 때만 바뀌지 만 충분하지는 않습니다.프로그래밍 방식으로 TChart 크기 변경
차트의 크기가 400x250 인 것을 볼 수 있듯이, 원래 차트와 "다시 포맷 된"차트입니다. 차트 크기를 조정할 수있는 특정 속성이 있습니까? 그에 따라 축의 크기를 조정할 수 있습니까? 내가 여기에 이름 충돌이 생각
procedure CreateChart(parentform: TForm);
//actually formatChart is a CreateChart anf fChart a member of my class
begin
fchart:= TChart.Create(parentform);
fchart.Parent:= parentform;
fchart.AxisVisible := true;
fchart.AutoSize := false;
fChart.color := clWhite;
fchart.BottomAxis.Automatic := true;
fchart.BottomAxis.AutomaticMaximum := true;
fchart.BottomAxis.AutomaticMinimum := true;
fchart.LeftAxis.Automatic := true;
fchart.LeftAxis.AutomaticMaximum := true;
fchart.LeftAxis.AutomaticMinimum := true;
fchart.view3D := false;
end
procedure formatChart(width, height, xmin, xmax, ymin, ymax: double);
//actually formatChart is a method anf fChart a member of my class
begin
with fChart do
begin
Color := clWhite;
fChart.Legend.Visible := false;
AxisVisible := true;
AllowPanning := pmNone;
color := clWhite;
Title.Visible := False;
BottomAxis.Minimum := 0; //to avoid the error maximum must be > than min
BottomAxis.Maximum := xmax;
BottomAxis.Minimum := xmin;
BottomAxis.ExactDateTime := False ;
BottomAxis.Grid.Visible := False ;
BottomAxis.Increment := 5 ;
BottomAxis.MinorTickCount := 0;
BottomAxis.MinorTickLength := 5;
BottomAxis.Ticks.Color := clBlack ;
BottomAxis.TickOnLabelsOnly := False;
DepthAxis.Visible := False;
LeftAxis.Automatic := false;
LeftAxis.AutomaticMaximum := false;
LeftAxis.AutomaticMinimum := false;
LeftAxis.Minimum := ymin;
LeftAxis.Maximum := ymax;
LeftAxis.Minimum := ymin;
LeftAxis.TickLength := 5;
Width := round(width);
Height := round(height);
View3D := False ;
end;
end;
대단히 고맙습니다. 오류가 내 코 밑에 있었고 나는 그것을 볼 수 없었습니다! 나는 "with"를 사용하여 안전한면에있는 것을 생각했지만 속성의 긴 목록을 설정하는 데 일부 타이핑을 저장하는 대신, "with"의 악마가 나에게 보여주었습니다! – lib
많은 델파이 프로그래머에게 이런 일이 일어났습니다. 프로 시저/함수 호출에서 일반적인 관행은 모든 매개 변수 이름을 'A'로 시작하는 것입니다. 이것은 당신을 여기에서 구할 수 있었지만 링크에 명시된 바와 같이 "with"키워드는 사용하지 마십시오. –
+1. 할 수만 있다면 마지막 문장에 두 번째 upvote를 추가합니다. :-) –