Page 1 of 1

Arrows on Axis

Posted: Wed Jul 13, 2005 8:18 am
by 8437678
Hi,

TChart 6.01
I want to have arrows on the end of the axis.
It is possible ? How to do it ?

Kind regards,
Bernard

PS : In French
Comment faire pour avoir des flèches sur l'extrémité des axes ?
Merci beaucoup
Bernard

Posted: Wed Jul 13, 2005 9:07 am
by narcis
Hi Bernard,

It's pretty easy, you just need to use AxisArrows tool. You'll find an example of that at TeeChart features demo, available at TeeChart program group. The example is "All Features -> Welcome! -> Tools -> Axis arrows".

Posted: Thu Oct 20, 2005 7:18 am
by 8437678
Hi,

Thanks for your answer
I have arrows at the end of each axis.
I want to have it visible but not Active (a click on the arrow don't move the points)
Kind regards,
Bernard

In French :
Merci pour la réponse.
J'ai réussi (depuis longtemps) à avoir les flèches au bout des axes.
Je veux voir ces flèches et empêcher qu'un clic sur la flèche ne déplace les points.
Merci
Bernard

Posted: Thu Oct 20, 2005 8:02 am
by narcis
Hi Bernard,

I'm afraid there is some kind of incompatibility when setting tool not being active but visible. Could you please be more specific on a case where would you need that approach to see if we can help you finding a solution?

Posted: Thu Oct 20, 2005 12:13 pm
by 8437678
Hi Narcis,

I want just to have arrows at the end of each axis.
We make this arrows at school in France in Physics (or math)
Thanks
Bernard

In French :
Je souhaite avoir simplement des flèches à la fin de chaque axes comme on fait en classe dans les cours de Physique ou de math
Merci
Bernard

Posted: Thu Oct 20, 2005 2:40 pm
by narcis
Hi Bernard,

Then you'd better custom draw the arrows on TChart's canvas doing something like the code below in the OnAfterDraw event:

Code: Select all

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var
  LU0,LU1,LD0,LD1,BL0,BL1,BR0,BR1: TPoint;
  ArrowLength, ArrowWidth, ArrowHeight, Z: Integer;
  FillArrows: Boolean;
begin
  FillArrows:=true;
  ArrowLength:=20;
  ArrowWidth:=10;
  ArrowHeight:=10;
  Z:=0;

  With Chart1.Axes do
  begin
    //Left Axis UP Arrow
    LU0.X:=Left.PosAxis;
    LU0.Y:=Left.IStartPos+ArrowLength;
    LU1.X:=Left.PosAxis;
    LU1.Y:=Left.IStartPos;

    //Left Axis Down Arrow
    LD0.X:=Left.PosAxis;
    LD0.Y:=Left.IEndPos-ArrowLength;
    LD1.X:=Left.PosAxis;
    LD1.Y:=Left.IEndPos;

    //Bottom Axis Left Arrow
    BL0.X:=Bottom.IStartPos+ArrowLength;
    BL0.Y:=Bottom.PosAxis;
    BL1.X:=Bottom.IStartPos;
    BL1.Y:=Bottom.PosAxis;

    //Bottom Axis Right Arrow
    BR0.X:=Bottom.IEndPos-ArrowLength;
    BR0.Y:=Bottom.PosAxis;
    BR1.X:=Bottom.IEndPos;
    BR1.Y:=Bottom.PosAxis;
  end;

  With Chart1.Canvas do
  begin
    //Arrow(Filled: Boolean; Const FromPoint, ToPoint: TPoint; ArrowWidth, ArrowHeight, Z: Integer);
    Arrow(FillArrows, LU0, LU1, ArrowWidth, ArrowHeight, Z);
    Arrow(FillArrows, LD0, LD1, ArrowWidth, ArrowHeight, Z);

    Brush.Color:=clBlack;

    Arrow(FillArrows, BL0, BL1, ArrowWidth, ArrowHeight, Z);
    Arrow(FillArrows, BR0, BR1, ArrowWidth, ArrowHeight, Z);
  end;
end;

Posted: Thu Oct 20, 2005 3:34 pm
by 8437678
Thanks Narcis,

It is what I want to have
Bernard

In French :
Merci beaucoup, c'est tout à fait ce que je souhaite