Skip to main content

TdxChartHitTest.Argument Property

Returns the argument on the primary X-Axis that corresponds to the inspected point position within the plot area of an XY diagram.

Declaration

property Argument: Variant read;

Property Value

Type Description
Variant

The argument on the main axis of arguments that corresponds to the inspected point within the plot area of an XY diagram.

This property returns varNull if the inspected point is not within the plot area of an XY diagram (for example, when the inspected point is within a simple diagram).

Remarks

Use Argument and Value properties to obtain the coordinates of the inspected point within the plot area of an XY diagram in corresponding measurement units of the main X and Y-axes.

To obtain the coordinates of the inspected point on any primary or secondary axis, call the GetAxisCoordinate function.

Code Example

The following code example demonstrates an OnMouseMove event handler that displays mouse pointer coordinates (in axis measurement units) in the application form caption:

uses dxChartControl;
// ...
procedure TMyForm.dxChartControl1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  if dxChartControl1.HitTest.Diagram <> nil then
  begin
    if (dxChartControl1.HitTest.Argument <> VarNull) and (dxChartControl1.HitTest.Value <> VarNull) then
    Caption := Caption + 'X: ' + VarToStr(dxChartControl1.HitTest.Argument) +
      ' Y: ' + VarToStr(dxChartControl1.HitTest.Value);
  end;
end;

VCL Chart Control: Inspected Point Coordinates in Axis Measurement Units

To obtain horizontal and vertical coordinates (in pixels) of the inspected point within the Chart control client area, use the Point property.

Chart HitTest Information Updates

Chart HitTest information updates every time when:

  • The OnHotTrackElement or OnMouseMove event occurs. Point.X and Point.Y property values change to the corresponding mouse pointer coordinates.
  • You call the CalculateHitTest procedure. Point.X and Point.Y property values change to the procedure’s X and Y parameter values.

In addition, Argument and Value property values change to corresponding coordinates (in axis measurement units) if the inspected point is within the plot area of an XY diagram.

See Also