Page 1 of 1

Marks Tip Tool???

Posted: Thu Apr 01, 2010 4:33 pm
by 12046464
I would like to display the value of a series in the chart when the user hovers the mouse over that series. I saw in the features something about a Marks Tip Tool but cannot load the source for the example in Delphi 2010. I get an error: Class TMarksTipTool not found.

I am attempting this in TeeChart Standard 8 for Delphi 2010.

How can I accomplish this either by using/enabling this MarksTipTool or by code???

Thanks all,
Branden Johnson

Re: Marks Tip Tool???

Posted: Tue Apr 06, 2010 11:33 am
by yeray
Hi Branden Johnson,

As you can see here, the Standard version doesn't give access to the Tools.
If you want to upgrade your license to the Pro version, please contact the sales department at sales at steema dot com.

On the other hand, you always can do it manually like in the following example:

Code: Select all

var line1: TLineSeries;
    MouseX, MouseY: Integer;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.View3D:=false;

  line1:=Chart1.AddSeries(TLineSeries.Create(self)) as TLineSeries;
  line1.FillSampleValues();
  line1.Pen.Width:=2;

  Chart1.OnMouseMove:=Chart1MouseMove;
end;

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
  MouseX:=X;
  MouseY:=Y;
  if line1.Clicked(X,Y)>-1 then Chart1.Draw;
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
var Index: Integer;
    text: string;
begin
  Index:=line1.Clicked(MouseX, MouseY);
  if Index>-1 then
  begin
    with Chart1.Canvas do
    begin
      text:=FloatToStr(line1.YValue[Index]);
      Rectangle(Rect(MouseX,MouseY,MouseX+TextWidth(text),MouseY-TextHeight(text)));
      TextOut(MouseX,MouseY-TextHeight(text),text);
    end;
  end;
end;