vcl-dxchartcontrol-dot-tdxcustomchartcontrol-4bda3006.md
Allows you to respond to mouse pointer movement between visual elements within the Chart control client area.
property OnHotTrackElement: TdxChartHotTrackElementEvent read; write;
You can handle the OnHotTrackElement event to respond to mouse pointer movement between chart elements. For example, you can change the appearance of certain hot-track elements to complement hints and tooltips in the Chart control.
The OnHotTrackElement event occurs every time the mouse pointer crosses borders of visual Chart elements.
The Sender parameter provides access to the Chart control that raised the OnHotTrackElement event. You can use AArgs.Element and AArgs.PreviousElement parameters to identify and access both current and previous hot-tracked elements.
Refer to the TdxChartHotTrackElementEvent procedural type description for detailed information on parameters accessible within an OnHotTrackElement event handler.
The following code example demonstrates an OnHotTrackElement event handler that applies a white diagonal crosshatch to the currently hot-tracked bar series:
procedure TMyForm.dxChartControl1HotTrackElement(Sender: TObject;
const AArgs: TdxChartHotTrackElementEventArgs);
var
ABarView: TdxChartXYSeriesBarView;
begin
if ((AArgs.HitTest.Diagram = cdVisitors) and (AArgs.HitTest.HitCode = TdxChartHitCode.SeriesPoint)) then
begin
// Displays a white crosshatch on all bars of the hot-tracked series
ABarView := AArgs.HitTest.SeriesPoint.Series.View as TdxChartXYSeriesBarView;
ABarView.Appearance.FillOptions.Mode := TdxFillOptionsMode.Hatch;
ABarView.Appearance.FillOptions.HatchStyle := TdxFillOptionsHatchStyle.DiagonalCross;
ABarView.Appearance.FillOptions.Color2 := TdxAlphaColors.White;
end;
if ((AArgs.PreviousHitTest.Diagram = cdVisitors) and
(AArgs.PreviousHitTest.HitCode = TdxChartHitCode.SeriesPoint)) then
begin
// Removes a white crosshatch from all bars of the previously hot-tracked series
ABarView := AArgs.PreviousHitTest.SeriesPoint.Series.View as TdxChartXYSeriesBarView;
ABarView.Appearance.FillOptions.Mode := TdxFillOptionsMode.Solid;
end;
end;
void __fastcall TMyForm::dxChartControl1HotTrackElement(TObject *Sender,
const TdxChartHotTrackElementEventArgs *&AArgs)
{
TdxChartXYSeriesBarView *ABarView;
if((AArgs->HitTest->Diagram == cdVisitors) && (AArgs->HitTest->HitCode == TdxChartHitCode::SeriesPoint))
{
// Displays a white crosshatch on all bars of the hot-tracked series
ABarView = dynamic_cast<TdxChartXYSeriesBarView*>(AArgs->HitTest->SeriesPoint->Series->View);
ABarView->Appearance->FillOptions->Mode = TdxFillOptionsMode::Hatch;
ABarView->Appearance->FillOptions->HatchStyle = TdxFillOptionsHatchStyle::DiagonalCross;
ABarView->Appearance->FillOptions->Color2 = TdxAlphaColors::White;
}
if((AArgs->PreviousHitTest->Diagram == cdVisitors) &&
(AArgs->PreviousHitTest->HitCode == TdxChartHitCode::SeriesPoint))
{
// Removes a white crosshatch from all bars of the previously hot-tracked series
ABarView = dynamic_cast<TdxChartXYSeriesBarView*>(AArgs->PreviousHitTest->SeriesPoint->Series->View);
ABarView->Appearance->FillOptions->Mode = TdxFillOptionsMode::Solid;
}
}
See Also
TdxCustomChartControl.HitTest Property