Skip to main content

TdxChartHitTest.Diagram Property

Provides access to the diagram to which the inspected point belongs.

Declaration

property Diagram: TdxChartCustomDiagram read;

Property Value

Type Description
TdxChartCustomDiagram

The currently inspected diagram if the inspected point hovers over a diagram (including any of its visual elements) in the Chart). Otherwise, the Diagram property returns nil (in Delphi) or nullptr (in C++Builder).

Remarks

You can use the Diagram property to identify and access a diagram at the inspected point; that is, when the HitCode property returns one of the following values:

Axis

The inspected point belongs to an axis in an XY diagram.

You can use Axis and Diagram properties to access the inspected axis and its parent diagram, respectively.

AxisValueLabel

The inspected point belongs to an axis value label in an XY diagram.

You can use AxisValueLabel, Axis, and Diagram properties to access the inspected value label and its parent axis and diagram, respectively.

Diagram

The inspected point is within one of the visible diagrams, but does not belong to any of the diagram elements, such as axes, series, labels, etc.

You can use only the Diagram property to access an inspected diagram. Cast the property value to the TdxChartSimpleDiagram or TdxChartXYDiagram class depending on the actual diagram type to access all diagram-specific public API members.

Series

The inspected point belongs to a series in a diagram.

You can use Series and Diagram properties to access the inspected series and its parent diagram, respectively. Cast the Series property value to the TdxChartSimpleSeries or TdxChartXYSeries class depending on the actual series type to access all series-specific public API members.

SeriesPoint

The inspected point belongs to a series point in a diagram.

You can use SeriesPoint, Series, and Diagram properties to access the inspected series point and its parent series and diagram, respectively.

SeriesValueLabel

The inspected point is within a series value label.

You can use SeriesValueLabel, SeriesPoint, and Diagram properties to access the inspected series value label, and its parent series point and diagram, respectively.

TotalLabel

The inspected point belongs to a total label of a Pie or Doughnut series.

You can use TotalLabel and Diagram properties to access the inspected total label and its parent diagram, respectively.

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

See Also