Skip to main content

TdxChartCustomDiagram.OnGetValueLabelDrawParameters Event

Allows you to customize series value labels.

Declaration

property OnGetValueLabelDrawParameters: TdxChartGetValueLabelDrawParametersEvent read; write;

Remarks

The OnGetValueLabelDrawParameters event occurs every time the diagram is about to determine how to draw a series value label. You can handle this event to customize individual value labels based on certain conditions. For example, you can display different measurement units for different series points.

Example

The code example below displays different measurement units in value labels. If a series value exceeds one million, the corresponding value label displays the million digits followed by the M character. If a series 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.cdAreaGetValueLabelDrawParameters(Sender: TdxChartCustomDiagram;
  AArgs: TdxChartGetValueLabelDrawParametersEventArgs);
begin
  if AArgs.SeriesPoint.Value >= 1000 * 1000 then // Millions
    AArgs.Text := Format('%.1fM', [AArgs.SeriesPoint.Value / (1000 * 1000)])
  else if AArgs.SeriesPoint.Value >= 1000 then // Thousands
    AArgs.Text := Format('%.0fk', [AArgs.SeriesPoint.Value / 1000])
  else
    AArgs.Text := Format('%0f', [AArgs.SeriesPoint.Value]);
end;

VCL Chart Control: Custom Axis and Value Labels

Event Handler Parameters

Refer to the TdxChartGetValueLabelDrawParametersEvent procedural type description for detailed information on all parameters accessible in an OnGetValueLabelDrawParameters event handler.

See Also