Page 1 of 1

hide/remove axis labels but not chart lines

Posted: Tue Nov 13, 2007 4:26 pm
by 9232632
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.

Posted: Tue Nov 13, 2007 4:33 pm
by narcis
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!