Set Position of Axis Lable

TeeChart for ActiveX, COM and ASP
Post Reply
tirby
Newbie
Newbie
Posts: 84
Joined: Mon Mar 16, 2009 12:00 am

Set Position of Axis Lable

Post by tirby » Tue Jan 06, 2015 5:58 pm

I'm trying to set the position of the Axis Label with respect to the axis.
If I have the Axis scaled for 0 to 1000 and marks every 100, then the spacing between the label and the values is too great.
We want to reduce the spacing to something less.
How can I accomplish this?

Thanks!

Yeray
Site Admin
Site Admin
Posts: 9622
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Set Position of Axis Lable

Post by Yeray » Wed Jan 07, 2015 9:03 am

Hi Tirby,
tirby wrote:the spacing between the label and the values is too great.
We want to reduce the spacing to something less.
I'm not sure to understand what exact distance do you mean.
This is how it looks for me here:
test.png
test.png (26.98 KiB) Viewed 11662 times

Code: Select all

Private Sub Form_Load()  
  TChart1.AddSeries scLine
  TChart1.Series(0).FillSampleValues
  
  TChart1.Axis.Left.SetMinMax 0, 1000
  TChart1.Axis.Left.Increment = 100
End Sub
What space do you want to reduce?
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

tirby
Newbie
Newbie
Posts: 84
Joined: Mon Mar 16, 2009 12:00 am

Re: Set Position of Axis Lable

Post by tirby » Wed Jan 07, 2015 2:34 pm

Yeray,

Thanks for looking at this.

What I'm trying to do is change the spacing between the the 2 black arrows as shown on the picture below.
Attachments
Spacing.png
Spacing.png (17 KiB) Viewed 11613 times

Yeray
Site Admin
Site Admin
Posts: 9622
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Set Position of Axis Lable

Post by Yeray » Thu Jan 08, 2015 2:38 pm

Hello,

I'm afraid you can't control the axis title position.
Instead, you could hide the axis title and draw its text manually as follows:

Code: Select all

Private Sub TChart1_OnAfterDraw()
  With TChart1.Axis.Left
    XPos = .Position - .Labels.MaxWidth - .TickLength
    YPos = .IStartPos + ((.IEndPos - .IStartPos) / 2) + (TChart1.Canvas.TextWidth(.Title.Caption) / 2)
  End With
  
  With TChart1.Canvas
    .RotateLabel XPos, YPos, TChart1.Axis.Left.Title.Caption, 90
  End With
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply