vcl-dxchartcontrol-a3c6961d.md
Stores Chart control HitTest information.
TdxChartHitTest = class(
TObject
)
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.
Chart HitTest information updates every time when:
X and Y parameters define inspected point coordinates within the Chart control client area.The list below outlines key class members that allow you to identify visual elements.
InPlotAreaIdentifies if the inspected point is within the plot area of an XY diagram.HitCodeIdentifies the Chart control’s visual element to which the inspected point belongs.PointReturns pixel coordinates of the inspected point within the Chart control’s client area.
Argument | ValueReturn 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.Axis | AxisValueLabelProvide access to inspected axes and their value labels.GetAxisCoordinateReturns the X or Y-coordinate of the inspected point within the plot area for the specified axis in its measurement units.
TotalLabelProvides access to the series total label to which the inspected point belongs.
DiagramProvides access to the diagram to which the inspected point belongs.Legend | LegendItemProvide access to inspected legend panes and items.Series | SeriesPoint | SeriesValueLabelProvide access to inspected series and their visual elements.TitleProvides access to the axis, chart, diagram, legend, or series title to which the inspected point belongs.
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;
#include "dxChartControl.hpp"
// ...
void __fastcall TMyForm::dxChartControl1MouseMove(TObject *Sender, TShiftState Shift, int X, int Y)
{
if(dxChartControl1->HitTest->Diagram != nullptr)
{
if((dxChartControl1->HitTest->Argument != VarNull) && (dxChartControl1->HitTest->Value != VarNull))
Caption = Caption + "X: " + VarToStr(dxChartControl1->HitTest->Argument) +
" Y: " + VarToStr(dxChartControl1->HitTest->Value);
}
}
The following public API members reference a TdxChartHitTest object:
TdxCustomChartControl.HitTestProvides access to HitTest information on the inspected point within the Chart control client area.TdxChartHotTrackElementEventArgs.HitTestProvides access to HitTest information on the currently hot-tracked visual Chart element.TdxChartHotTrackElementEventArgs.PreviousHitTestProvides access to HitTest information on the visual Chart element that was hot-tracked before the current OnHotTrackElement event occurrence.
TObject TdxChartHitTest
See Also