Page 1 of 1

Chart - mouse over event

Posted: Thu Jul 26, 2007 7:24 am
by 8442698
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

Posted: Thu Jul 26, 2007 8:27 am
by Pep
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.

Posted: Thu Jul 26, 2007 2:06 pm
by 8442698
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

Posted: Fri Jul 27, 2007 10:07 am
by yeray
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!

Posted: Sun Jul 29, 2007 6:09 am
by 8442698
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

Posted: Sun Jul 29, 2007 7:42 am
by 9047589
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

Posted: Sun Jul 29, 2007 8:20 pm
by 8442698
thanks Alexander, exactly what I needed, you're a star.
cheers
Sean

Posted: Sun Jul 29, 2007 9:54 pm
by 9047589
Pleased to hear :oops:
Alexander