YOUSEFUL / DELPHI / COMPONENTS

TAtlasPlotPointEvent

Event type of TAtlasPlot.OnPointClick: the clicked series and point index.

Type Unit Atlas.Plot · Product Atlas Plot

Description

TAtlasPlotPointEvent = procedure(Sender: TObject; Series: TAtlasPlotSeries; PointIndex: Integer) of object;

Sender is the chart, Series the series that was hit and PointIndex the index of the point in it, so Series[PointIndex] gives the point. For a pie, PointIndex is the slice's point index (gaps and non-positive points, which draw no slice, are never reported).

This type has no members of its own beyond those listed in its description.

Examples

Handle a point click

An event handler that writes the clicked point to a label.

pascal
uses
  System.SysUtils, Vcl.Forms, Vcl.StdCtrls, Atlas.Plot, Atlas.PlotSeries;

type
  TChartForm = class(TForm)
  private
    FStatus: TLabel;
    procedure PointClicked(Sender: TObject; Series: TAtlasPlotSeries; PointIndex: Integer);
  public
    procedure Attach(Plot: TAtlasPlot; Status: TLabel);
  end;

procedure TChartForm.Attach(Plot: TAtlasPlot; Status: TLabel);
begin
  FStatus := Status;
  Plot.OnPointClick := PointClicked;
end;

procedure TChartForm.PointClicked(Sender: TObject; Series: TAtlasPlotSeries; PointIndex: Integer);
var
  P: TAtlasPlotPoint;
begin
  P := Series[PointIndex];
  FStatus.Caption := Format('%s #%d: %g at %g', [Series.Title, PointIndex, P.Y, P.X]);
end;

TAtlasPlot · TAtlasPlotSeries

Also in Atlas Plot

TAtlasPlot