Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TMS VCL Chart
Retrieving the serie values at crosshair

While the tracker window will display serie values at crosshair position, it can often be interesting to retrieve the values in code. Following code snippet shows the serie values in the caption of the form:
procedure TForm1.AdvChartView1MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
var
  i: integer;
  cp: TChartPoint;
  s: string;
begin
  with AdvChartView1.Panes[0] do
  begin
    s := '';
    for i := 0 to Series.Count - 1 do
    begin
      cp := GetChartPointAtCrossHair(i);
      if s = '' then
        s := floattostr(cp.SingleValue)
      else
        s := s + ':' + floattostr(cp.SingleValue);
    end;
  end;
end;