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

TdxChartHitTest.Value Property

Returns the value on the primary Y-axis that corresponds to the inspected point position within the plot area of an XY diagram.

#Declaration

Delphi
property Value: Variant read;

#Property Value

Type Description
Variant

The value on the main axis of values 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: Get Mouse Pointer Coordinates

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;

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.

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