word wrap on axis titles?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
TestAlways
Advanced
Posts: 228
Joined: Tue Aug 28, 2007 12:00 am
Location: Oregon, USA

word wrap on axis titles?

Post by TestAlways » Mon Jul 21, 2008 4:36 pm

I have to have multiple sizes for various charts--is there any way to have a word wrap option for the axis titles? ( I did not see anything like this).

Thank you,
Ed Dressel

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

Post by Yeray » Tue Jul 22, 2008 8:29 am

Hi Ed,

I'm afraid there is not an automatic option to do that. However, you could calculate the length of the title string in pixels, compare with the axis size, and add your "end of line" manually. Here is how your method could start:

Code: Select all

procedure TForm1.WordWrap;
begin
  //Bottom Axis
  Canvas.Font.Size := Chart1.Axes.Bottom.Title.Font.Size;
  TitleWidth := Canvas.TextWidth(Chart1.Axes.Bottom.Title.Caption);
  AxisWidth := Chart1.Axes.Bottom.IEndPos -   Chart1.Axes.Bottom.IStartPos;

  if (AxisWidth < TitleWidth) then
  begin
  //... Find a substring in the title shorter than AxisWidth and add the chars #13#10 to do the line jump
  end;

  //Next Axis
  //...
end;
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