Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxChartXYDiagram.OnGetAxisValueLabelDrawParameters Event

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

#Declaration

Delphi
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.

#Code Example: Display Multiple Measurement Units in Value Labels

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