C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[44610] Re:Re:Re:TChart 에서 LeftAxis 와 RightAxis 를 같이 표현하려면...
외랑 [] 3054 읽음    2006-04-24 19:03
저 역시 상용 컨트롤입니다만, 버전이 5입니다.
더 세밀한 제어를 원하신다면 커스텀Axis를 추가하셔서 사용하는 방법이 있다고 헬프에 나오네요..
v5의 도움말에 델파이 코드를 보여주는군요..

Multiple Custom Axes
Together with the PositionPercent and stretching properties, it’s possible to have unlimited axes floating anywhere on the chart. Scroll , zoom , and axis hit-detection also apply to custom-created axes. Creating extra axes is now possible both at designtime via the Chart Editor and at runtime via a few lines of code:

Via the Chart Editor
TeeChart version 5 now offers you the ability to create custom axes at designtime enabling them to be saved in TeeChart's tee file format. To achieve this, right click over the Chart and select Custom Axes... and click on the Add New (Ins) icon to add a new Custom Axis. Then right click over the Chart a second time and select Edit Chart.... From the Chart tab select the Axis page and in this page select the Position tab making sure you have your new Custom Axis highlighted. The Horizontal checkbox on this page allows you to define your new Custom Axis as an horizontal axis or to leave it as the default vertical axis. The rest of this page and the other tabs in the Axis page can be used to change the Scales, Increment, Titles, Labels, Ticks and Position of the Custom Axis as explained above. To associate this new Custom Axis with the Data Series you desire select the Series tab and go to the General page where the dropdown Comboboxes 'Horizontal Axis' and 'Vertical Axis' will enable you to select your new Custom Axis depending on whether you previously defined it as vertical or horizontal.

Via Code

Example
procedure TForm1.BitBtn2Click(Sender: TObject);
Var MyAxis : TChartAxis ;
begin
  MyAxis := TChartAxis.Create(  Chart1 );
  Series2.CustomVertAxis := MyAxis;
  //You can modify any property of the new created axes, such as the axis color or axis title
  With MyAxis do
  begin
    Axis.Color:=clGreen ;
    Title.Caption := 'Extra axis' ;
    Title.Font.Style:=[fsBold];
    Title.Angle := 90;
    PositionPercent := 20; //percentage of Chart rectangle
  end;
end;

You are able to then position the new Axis in overall relation to the Chart by using the StartPosition and EndPosition properties.

StartPosition:=50;
EndPosition:=100;

These figures are expressed as percentages of the Chart Rectangle with 0 (zero) (in the case of a vertical Axis) being Top. These properties can be applied to the Standard Axes to create completely partitioned 'SubCharts' within the Chart.

Example
  With Chart1.LeftAxis do
  begin
    StartPosition:=0;
    EndPosition:=50;
    Title.Caption:='1st Left Axis';
    Title.Font.Style:=[fsBold];
  end;

The above 2 coded examples when combined with the following data:

var t: integer;
begin
  for t := 0 to 10 do
  begin
    Series1.AddXY(t,10+t,'',clTeeColor);
    if t > 1 then
      Series2.AddXY(t,t/2,'',clTeeColor);
  end;

...will show the following Chart:

     Multiple axes

Another technique for adding Custom Axes would be the following which uses the Axis List as the focal point by using the List Add then by accessing the Axis by Index:

//Add data to Series:
procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues(10);
  Series2.FillSampleValues(10);
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
var
tmpVertAxis: TChartAxis;
tmpHorizAxis: TChartAxis;
begin
  {Add vertical Axis}
  Chart1.CustomAxes.Add;
  tmpVertAxis:=Chart1.CustomAxes[0];
  tmpVertAxis.PositionPercent:=50;
  Series1.CustomVertAxis:=tmpVertAxis;

  {Add horizontal Axis}
  Chart1.CustomAxes.Add;
  tmpHorizAxis:=Chart1.CustomAxes[1];

  tmpHorizAxis.Horizontal:=True;
  tmpHorizAxis.Axis.Color:=clGreen;
  tmpHorizAxis.PositionPercent:=50;
  Series1.CustomHorizAxis:=tmpHorizAxis;
end;

Options are limitless! We advise caution when using Custom Axes as it is easy to start filling the screen with new axes and to lose track of which one you wish to manage !

참고하시라고 일단 내용은 올려봅니다.
데모 프로그램에서는 사용자Axis를 4개까지 보여주는군요.. 화이팅하시고 원하시는대로 되시길...바랍니다.


Discer 님이 쓰신 글 :
: 답글 감사합니다.
:
: 하지만 저는 상용컨트롤을 쓰고 있어서 정확하게 메뉴가 일치하지 않는거 같습니다.
:
: 또 데이터를 Add 할때.. left , right 를 어떻게 하는지에 대해서
:
: 좀더 자세한 설명 부탁드립니다.
:
: 다시 한번 감사드립니다.

+ -

관련 글 리스트
44601 TChart 에서 LeftAxis 와 RightAxis 를 같이 표현하려면... Discer 956 2006/04/24
44607     Re:TChart 에서 LeftAxis 와 RightAxis 를 같이 표현하려면... 외랑 1707 2006/04/24
44609         Re:Re:TChart 에서 LeftAxis 와 RightAxis 를 같이 표현하려면... Discer 948 2006/04/24
44611             Re:Re:Re:TChart 에서 LeftAxis 와 RightAxis 를 같이 표현하려면... smleelms 1036 2006/04/24
44610             Re:Re:Re:TChart 에서 LeftAxis 와 RightAxis 를 같이 표현하려면... 외랑 3054 2006/04/24
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.