Chart - mouse over event

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
sean
Newbie
Newbie
Posts: 11
Joined: Fri Jan 30, 2004 5:00 am
Location: uk
Contact:

Chart - mouse over event

Post by sean » Thu Jul 26, 2007 7:24 am

D6 Pro, Teechart 7.07, chart with several lineseries.

I would like to be able to have an edit box display the X-axis and Y-axis values of the cursor location on a Tchart which holds several lineseries. I've tried experimenting with nearest tool and marktips tool, but they don't quite seem to give what I want. As the user moves the cursor around the chart I'd like the edit box to show someting like X=value Y=Value

Any help appreciated.

cheers
Sean

Pep
Site Admin
Site Admin
Posts: 3298
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Jul 26, 2007 8:27 am

Hi Sean,

I've posted one example which could help you at newsgroup news://www.steema.net/steema.public.attachments .
It shows YValues of some Series moving the mouse over the Chart.

sean
Newbie
Newbie
Posts: 11
Joined: Fri Jan 30, 2004 5:00 am
Location: uk
Contact:

Post by sean » Thu Jul 26, 2007 2:06 pm

thanks Josep,

How do I access the newgroup, I have www.steema.net set as newsgroup in Outlook but it doesn't find the news server. Is there an idiots guide for connecting to your news server you can piont me at please?

cheers
Sean

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Fri Jul 27, 2007 10:07 am

Hi Sean,

It's easy:
Go to "Tools->Accounts...".
Choose the "News" Tab.
Click at Add->News...
Enter your name and click "Next".
Enter your mail and click "Next".
Enter the server name: www.steema.net and click "Finish".
Close the Accounts window.
The should appear a window with the message: Would you like to download newsgroups from the news account you added? Click Yes.
Select the newsgroups you want to be subscribed to and click "Subscribe".
Click "OK".
Now to recieve the new posts you have to click on www.steema.net (at the left of the outlook window) and click "Synchronize Account" and the new messages will be shown at the left side again.

I hope it helps!
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

sean
Newbie
Newbie
Posts: 11
Joined: Fri Jan 30, 2004 5:00 am
Location: uk
Contact:

Post by sean » Sun Jul 29, 2007 6:09 am

thanks Josep,

I got that and see it uses a colorline tool. I was hoping for something which just tracked the mouse position rather than having to clicck something, some sort of chart.onmouseover event, is there a way to do that-

Procedure chart.onmouseover
begin
xval:=getchartbottomxis(cursorpos.x)
yval:=getchartleftaxis(cursorpos.y)
end

that sort of thing.
cheers
Sean

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Post by xxxxxx » Sun Jul 29, 2007 7:42 am

Hi, just a piece of code from a project that might help:

Code: Select all

procedure TMyForm.ChartsMouseMove(Sender: TObject; Shift: TShiftState;
  X, Y: Integer);
var
  wX, wYl, wYr : double;
  S : string;
begin
  with Chart1 do
  if not PtInRect(ChartRect, Point(X,Y)) then
    Hint:=Parent.Hint
  else begin
    wX:=BottomAxis.CalcPosPoint(X);
    wYl:=LeftAxis.CalcPosPoint(Y);
    wYr:=RightAxis.CalcPosPoint(Y);
    if wX<30000 then
      S:='X:'+Format('%8.2f',[wX])
    else
      S:='X:'+FormatDateTime('hh:nn:ss',wX);
    Hint:=S+' YL:'+Format('%8.2f',[wYl])+' YR:'+Format('%8.2f',[wYr]);
  end;
end;
It uses hint to display coordinates
Regards, Alexander
=================
TeeChart Pro v8.05, Delphi 5 & Turbo Delphi Professional for Win32., Delphi & C++Builder 2009

sean
Newbie
Newbie
Posts: 11
Joined: Fri Jan 30, 2004 5:00 am
Location: uk
Contact:

Post by sean » Sun Jul 29, 2007 8:20 pm

thanks Alexander, exactly what I needed, you're a star.
cheers
Sean

xxxxxx
Advanced
Posts: 128
Joined: Tue Jun 19, 2007 12:00 am
Location: Russia
Contact:

Post by xxxxxx » Sun Jul 29, 2007 9:54 pm

Pleased to hear :oops:
Alexander

Post Reply