Skip to main content

TdxCustomChartControl.OnHotTrackElement Event

Allows you to respond to mouse pointer movement between visual elements within the Chart control client area.

Declaration

property OnHotTrackElement: TdxChartHotTrackElementEvent read; write;

Remarks

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.

Event Occurrence

The OnHotTrackElement event occurs every time the mouse pointer crosses borders of visual Chart elements.

Event Parameters

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.

Code Example: Change Hot-Tracked Series Appearance

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;

VCL Chart Control: Custom Hot-Tracked Bar Series Appearance

See Also