Skip to main content

TdxChartXYDiagram.OnGetAxisValueLabelDrawParameters Event

Allows you to customize individual axis value labels in the diagram.

Declaration

property OnGetAxisValueLabelDrawParameters: TdxChartGetAxisValueLabelDrawParametersEvent read; write;

Remarks

The OnGetAxisValueLabelDrawParameters event occurs every time the XY diagram is about to determine how to draw an axis value label. You can handle this event to customize individual axis value labels depending on certain conditions. For example, you can display different measurement units for different axis value labels.

Example

The code example below displays different measurement units in labels of the axis of values. If an axis value exceeds one million, the corresponding value label displays the millions digits followed by the M character. If an axis value exceeds one thousand but is less than one million, the corresponding value label displays the thousands digits followed by the k character.

procedure TMyForm.cdAreaGetAxisValueLabelDrawParameters(Sender: TdxChartCustomDiagram;
  AArgs: TdxChartGetAxisValueLabelDrawParametersEventArgs);
begin
  if AArgs.Axis.ClassType <> TdxChartAxisY then Exit;
  if AArgs.Value >= 1000 * 1000 then // Millions
    AArgs.Text := Format('%.1fM', [AArgs.Value / (1000 * 1000)])
  else if AArgs.Value >= 1000 then // Thousands
    AArgs.Text := Format('%.0fk', [AArgs.Value / 1000])
  else
    AArgs.Text := Format('%0f', [AArgs.Value]);
end;

VCL Chart Control: Custom Axis and Value Labels

Event Handler Parameters

Refer to the TdxChartGetAxisValueLabelDrawParameterEvent procedural type description for information on parameters accessible in an OnGetAxisValueLabelDrawParameters event handler.

See Also