How does one create custom y-axis labels?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Andy
Newbie
Newbie
Posts: 3
Joined: Thu May 20, 2004 4:00 am

How does one create custom y-axis labels?

Post by Andy » Fri Jun 18, 2004 7:11 pm

How does one add custom labels to the y-axis in place
of the y-axis values that would typically appear there?

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

Post by Marjan » Sat Jun 19, 2004 2:17 pm

Hi, Andy.

How about this:

Code: Select all

  With Chart1.Axes.Left do
  begin
    Items.Clear;
    Items.Add(100,'ABC'); // add at 100.0 and also define custom label
    Items.Add(150);  // add at 150 and use this as axis label
    Items.Add(164);  // add at 164 and use this as axis label
  end;
There is also an example about this feature available in Teechart demo (custom axis labels).
An alternative solution is to use TChart OnGetAxis label event to change the existing axis labels.
Marjan Slatinek,
http://www.steema.com

Jan
Newbie
Newbie
Posts: 24
Joined: Fri Nov 15, 2002 12:00 am
Location: Germany

Post by Jan » Wed Jun 30, 2004 9:52 am

I have used something like this for annotating the axis directly from the fixed part (first line) of a stringgrid :
GridCoord is a TGridRect (type) variable. So it is possible to specify a part of a stringgrid and to visualise it without knowing which part the user will choose at runtime.

Chart1.BottomAxis.Items.Clear;
Chart1.BottomAxis.Automatic := True;
for RunnerX := GridCoord.Left to GridCoord.Right do Chart1.BottomAxis.Items.Add (RunnerX-GridCoord.Left, ResultStringGrid.Cells[RunnerX, 0]);

Post Reply