hide/remove axis labels but not chart lines

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
rperkins
Newbie
Newbie
Posts: 58
Joined: Wed May 26, 2004 4:00 am

hide/remove axis labels but not chart lines

Post by rperkins » Tue Nov 13, 2007 4:26 pm

have 5 charts lined up next to each other (left to right). (scales are set to the same values - left all the same and right all the same). would like to have only the left axis on the left chart and the right axis on the right chart visible. have figured out how to show and hide the labels/axis on the charts. problem is when i set either LeftAxis->Labels or LeftAxis->Axis to false, it also hides the horizontal "grid" lines. is there a way to accomplish this (no axis and/or labels, but showing gridlines)?

thanks.

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 13, 2007 4:33 pm

Hi rperkins,

Yes, you can do something like the code below where chart elements are hidden and labels are set to a blank space in the OnGetAxisLabel event.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  With Chart1.Axes.Left do
  begin
    Axis.Visible:=false;
    MinorTicks.Visible:=false;
    Ticks.Visible:=false;
  end;
end;

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
  if Sender=Chart1.Axes.Left then
    LabelText:=' ';
end;
Hope this helps!
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

Post Reply