0

I discover TMS VCL Chart and delphi.

In the TMS doc there is an example of code to retrieve the values of the points displayed on the "MouseMouve".

I adapted this code to retrieve the value of X, the one displayed on the axis (1,2,3,... by default) but I always have 0 in return.

What is the way to achieve this?

Thank you for your help and advice.

procedure TForm2.Chart1MouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
var
  i: Integer;
  cp: TchartPOint;
  s: string;
begin
  with Chart1.Panes[1] do
  begin
    s := '';
    for i := 0 to series.Count - 1 do
    begin
      cp := GetChartPointAtCrossHair(i);
      if s = '' then
      begin
        s := floattostr(cp.SingleXValue);
      end
      else
      begin
        s := s + ':' + floattostr(cp.SingleXValue);
      end;
    end;
    Label1.Caption := s;
  end;
end;
Tom Brunberg
  • 20,312
  • 8
  • 37
  • 54
sp506
  • 1

0 Answers0