TCustomAxisPanel.OnGetNextAxisLabel

TCustomAxisPanel.OnGetNextAxisLabel
TCustomAxisPanel

property OnGetNextAxisLabel: TAxisOnGetNextLabel;

Unit
TeEngine

Description
An OnGetNextAxisLabel event is used to define custom Axis Labels. Using this event you can customize Axis Labels positions and values.

This event gets called in a loop until you set the Stop parameter to False OR the LabelValue parameter is BIGGER than the Axis Maximum value.

The Stop parameter is True by default, meaning that if it's not set to False the first time this event gets called, TeeChart will draw the default Axis Labels.

The Sender parameter specifies the Axis subcomponent. It can be the Chart LeftAxis, RightAxis, TopAxis or BottomAxis axis components.

The LabelIndex parameter is an incremental counter for you to know which Label the event is asking for a value.

The LabelValue parameter must be filled with the desired Axis Label value.

You can use the TChart.OnGetAxisLabel event to override the default Axis Labels text with your preferred Axis Label string representation.

Example

procedure TAxisLabelsForm.Chart1GetNextAxisLabel(Sender: TChartAxis;
LabelIndex: Longint; var LabelValue: Double; var Stop: Boolean);
begin
if Sender=Chart1.LeftAxis then
Begin
{ In this example, we want the Vertical Left Axis to show
labels only for positive values, starting at zero and
with 250 label increment.
}
if LabelValue>=250 then LabelValue:=LabelValue+250
else LabelValue:=250;
End;

{ we want more labels !! }
Stop:=False;
end;