Skip to main content

TdxChartHitTest Class

Stores Chart control HitTest information.

Declaration

TdxChartHitTest = class(
    TObject
)

Remarks

HitTest information allows you to identify and access the inspected visual element (that is, a visual element at the current mouse pointer position or at the coordinates passed to the CalculateHitTest procedure) within the Chart control client area.

VCL Chart Control: Inspected Point Coordinates and Visual Chart Elements

Chart HitTest information updates every time when:

Main API Members

The list below outlines key class members that allow you to identify visual elements.

Point
Returns pixel coordinates of the inspected point within the Chart control’s client area.
HitCode
Identifies the Chart control’s visual element to which the inspected point belongs.
Argument | Value
Return the coordinates of the inspected point within the plot area of an XY diagram in corresponding axis measurement units.
InPlotArea
Identifies if the inspected point is within the plot area of an XY diagram.
Series | SeriesPoint | SeriesValueLabel
Provide access to inspected series and their visual elements.
Title
Provides access to the axis, chart, diagram, legend, or series title to which the inspected point belongs.
Legend | LegendItem
Provide access to inspected legend panes and items.
Axis | AxisValueLabel
Provide access to inspected axes and their value labels.
TotalLabel
Provides access to the series total label to which the inspected point belongs.
Diagram
Provides access to the diagram to which the inspected point belongs.

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

Direct TdxChartHitTest Class References

The following public API members reference a TdxChartHitTest object:

TdxCustomChartControl.HitTest
Provides access to HitTest information on the inspected point within the Chart control client area.
TdxChartHotTrackElementEventArgs.HitTest
Provides access to HitTest information on the currently hot-tracked visual Chart element.
TdxChartHotTrackElementEventArgs.PreviousHitTest
Provides access to HitTest information on the visual Chart element that was hot-tracked before the current OnHotTrackElement event occurrence.

Inheritance

TObject
TdxChartHitTest
See Also