Aligning Left Axis for Multiple Charts

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
tbonejo
Newbie
Newbie
Posts: 73
Joined: Wed Sep 06, 2006 12:00 am
Contact:

Aligning Left Axis for Multiple Charts

Post by tbonejo » Wed Nov 22, 2006 6:40 pm

Hi,

Now I need to align the left axis on about 13 charts. This way looking at them all you could see the line ups for all the charts properly.

I didnt see anything in the features for it.


Thanks,

Tom
Tom

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Thu Nov 23, 2006 6:55 am

Hi, Tom.

This has to be done manually through setting some of the axis/chart properties. Here is an example:

Code: Select all

procedure LeftAlignCharts(Const Charts: Array of TCustomChart; aLeft: Integer; aWidth: Integer);
var i: Integer;
begin
  for i := Low(Charts) to High(Charts) do
  // Left align charts
  With Charts[i] do
  begin
    Left := aLeft;
    Width := aWidth;
    Margins.Left := 0;
    Axes.Left.TitleSize := 15;
    Axes.Left.LabelsSize := 30;
    Axes.Left.LabelsAlign := alDefault;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  // ...
  LeftAlignCharts([Chart1,Chart2],100,300);
end;
Marjan Slatinek,
http://www.steema.com

tbonejo
Newbie
Newbie
Posts: 73
Joined: Wed Sep 06, 2006 12:00 am
Contact:

Post by tbonejo » Fri Nov 24, 2006 4:32 pm

Thanks, that will get me going in the right direction!!!!
Tom

tbonejo
Newbie
Newbie
Posts: 73
Joined: Wed Sep 06, 2006 12:00 am
Contact:

Post by tbonejo » Tue Nov 28, 2006 12:27 pm

Ok got this working, however now my letters for the left axis titles are pushed together so its hard to even read at all. Any ideas on how to compensate for that?


Thanks,

Tom
Tom

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 28, 2006 12:39 pm

Hi Tom,

Is that axis labels overlap with axis title? If so, try using custom labels size as told here.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

tbonejo
Newbie
Newbie
Posts: 73
Joined: Wed Sep 06, 2006 12:00 am
Contact:

Post by tbonejo » Tue Nov 28, 2006 12:43 pm

narcis wrote:Hi Tom,

Is that axis labels overlap with axis title? If so, try using custom labels size as told here.
No the space between the labels and the title is fine. The letters for the title are overlapping eachother. On screen it looks fine but the drawmetatocanvas deal for printing seems to be causing it. I thin the strechtodraw might have something to do with it maybe.


Tom
Tom

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Dec 05, 2006 12:13 pm

Hi Tom,

it's difficult to know where is the problem without seeing the code. If you can send me a small app where I can see the problem (to pep@steema.com) and I'll take a look the code.

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Tue Dec 05, 2006 12:22 pm

Hi Tom,

btw, are you changing the Title font size ?
If so, have you used Font.Height instead of Font.Size for font size ?

tbonejo
Newbie
Newbie
Posts: 73
Joined: Wed Sep 06, 2006 12:00 am
Contact:

Post by tbonejo » Tue Dec 05, 2006 1:00 pm

I will try it pep and post back.

Thanks,

Tom
Tom

tbonejo
Newbie
Newbie
Posts: 73
Joined: Wed Sep 06, 2006 12:00 am
Contact:

Post by tbonejo » Tue Dec 05, 2006 1:34 pm

Pep,

Its almost like I need to do this:

Code: Select all

Chart1.LeftAxis.Title.Font.InterCharSize := 3;
But I do this it still doesnt seem to show up on the printout?


Thanks,

Tom
Tom

Pep
Site Admin
Site Admin
Posts: 3299
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Dec 14, 2006 1:55 pm

Hi Tom,

it's strange, I've test it here just printing a Chart with left axis title (setting interCharSize) and I get correct title printed (with correct separation), here is the code I used :

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
 Chart1.Axes.Left.Title.Caption:='my axis title';
 Chart1.Axes.Left.Title.Font.InterCharSize:=3;
end;

procedure TForm1.Button2Click(Sender: TObject);
var tmpMeta: TMetafile;
begin
  tmpMeta := Chart1.TeeCreateMetafile(True,Chart1.ClientRect);
  try
//    Printer.Orientation := poLandscape;
    Printer.BeginDoc;
    try
      Printer.Canvas.StretchDraw(Rect(10,10,Printer.PageWidth - 10, Printer.PageHeight - 10),tmpMeta);
    finally
      Printer.EndDoc;
    end;
  finally
    tmpMeta.Free;
  end;
end;

Post Reply