Page 1 of 1

Hide label text

Posted: Fri Sep 04, 2009 8:39 am
by 10549714
I have a financial chart where I sometimes add another chart at the bottom with volume information. This volume chart has its own left axis which is created at runtime. Now I have a requirement to remove the labels on this Axis. Everything else shuold be the same (ticks, grid lines etc). I have tried the following where I hoped the last statement would remove the labels but it also removed the grid lines etc. Any ideas?

Code: Select all

  chCustom.CustomAxes.Add;
  FaxVolumeAxis := chCustom.CustomAxes[chCustom.CustomAxes.Count-1];
  FaxVolumeAxis.StartPosition := FNextAxisEnd - 18;
  FaxVolumeAxis.EndPosition   := FNextAxisEnd;
  FaxVolumeAxis.Automatic := true;
  FaxVolumeAxis.Grid.Visible := true;
  FaxVolumeAxis.MinorTickCount := 0;
  FaxVolumeAxis.OtherSide := false;
  FaxVolumeAxis.Axis.Width := 1;
  FaxVolumeAxis.Labels := false;  //  <<<----- remove labels
BRgds
Marius

Re: Hide label text

Posted: Fri Sep 04, 2009 8:49 am
by narcis
Hi Marius,

In that case you can set labels to a blank space in the OnGetAxisLabel event, for example:

Code: Select all

procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
  if Sender=Chart1.Axes.Left then
    LabelText:=' ';
end;

Re: Hide label text

Posted: Fri Sep 04, 2009 8:54 am
by 10549714
Hi Narcis

Not very practical as this is one of several axis I could be adding at runtime. Is there not a property I could set or change the font size or something like that?

Marius

Re: Hide label text

Posted: Fri Sep 04, 2009 9:00 am
by narcis
Hi Marius,

You could set their colour to be the same as TChart's colour, for example:

Code: Select all

  Chart1.Axes.Left.LabelsFont.Color:=Chart1.Color;

Re: Hide label text

Posted: Fri Sep 04, 2009 9:08 am
by 10549714
Thanks

That does the trick

Marius