Easy way to reverse Legend Items or reverse pie drawing

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Hi Octane
Newbie
Newbie
Posts: 11
Joined: Tue Aug 29, 2006 12:00 am

Easy way to reverse Legend Items or reverse pie drawing

Post by Hi Octane » Tue Jan 09, 2007 9:11 pm

I have a minor issue that seems to require a lot of work to change. I noted that pie graphs start with the first pie piece created at 180 degrees and populates counter clockwise. When I use a half pie as a 'gauge' the left most pie piece corresponds to the bottom legend item, but is the first item for my graph. I need it to be reversed so it shows first. I tried using exchange, but it seems to need to be called after all items are drawn. Is there a way I can override the default drawing and populate the legend manually? Or is there a way to make the pie graphs start drawing from the left and populating clockwise?
Thanks,
Rick

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

Post by Narcís » Wed Jan 10, 2007 8:59 am

Hi Rick,

Have you tried using inverted legend?

Code: Select all

  Chart1.Legend.Inverted:=true;
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

Hi Octane
Newbie
Newbie
Posts: 11
Joined: Tue Aug 29, 2006 12:00 am

Perfect

Post by Hi Octane » Wed Jan 10, 2007 2:48 pm

I didn't even know that was an option. Thanks so much.

One more question. I have the following code for printing the graph:

Graph1 := TChart1(G1);
Meta := Graph1.TeeCreateMetafile(True, Rect(0, 0, Graph1.Width, Graph1.Height));
try
Canvas.StretchDraw(CRect, Meta);
finally
end;
finally
Meta.Free;
end;

When I print with this function the Legend colored symbols print out excessively wide and I can't figure out how to resize them to normal as they appear on the screen. Everything else prints normal size. Any ideas?

Thanks again,
Rick

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

Post by Pep » Mon Jan 15, 2007 10:34 am

Hi Rick,

are you modifying any legend symbol settings ? Using the following code it prints out fine here :

Code: Select all

procedure TForm1.BitBtn1Click(Sender: TObject);
var meta : TMetafile;
begin
   Chart1.BevelOuter := bvNone;
   Meta := Chart1.TeeCreateMetafile(True, Chart1.ClientRect);
   try
      Printer.Orientation := poPortrait;
      Printer.BeginDoc;
      try
         Printer.Canvas.StretchDraw(Rect(1,1,Printer.PageWidth - 1,
         Printer.PageHeight - 1),Meta);
      finally
         Printer.EndDoc;
      end;
   finally
      Meta.Free;
      Chart1.BevelOuter := bvRaised;
   end;
end;

Post Reply