Page 1 of 1

How does one create custom y-axis labels?

Posted: Fri Jun 18, 2004 7:11 pm
by 9337560
How does one add custom labels to the y-axis in place
of the y-axis values that would typically appear there?

Posted: Sat Jun 19, 2004 2:17 pm
by Marjan
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.

Posted: Wed Jun 30, 2004 9:52 am
by 8439980
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]);