X / Y Values at cursor position?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

X / Y Values at cursor position?

Post by moelski » Mon Nov 26, 2007 6:24 am

Hi support,

how is it possible to have the actual x / y values at the cursor tool like here:
Image

And a second question ...
Have a look at this picture:
Image

You can see a highlighted X value from the cursor (9.0) at the bottom axis. Would this be possible in the future? Maybe with a new tool ?

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

Post by Yeray » Mon Nov 26, 2007 10:07 am

Hi Dominik,

1) You can use OnChange event from the Cursor Tool to obtain its actual X and Y values.

2) You can use the Annotation Tool and calculate its position at the event I pointed to you before.

The following code shows you an example of how you can achieve both things. Note that ChartTool1 is the Cursor Tool and the ChartTool2 is the Annotation Tool.

Code: Select all

procedure TForm1.ChartTool1Change(Sender: TCursorTool; x, y: Integer;
  const XValue, YValue: Double; Series: TChartSeries; ValueIndex: Integer);
begin
  ChartTool2.Text := floattostr(XValue);
  Chart1.Draw;
  ChartTool2.Shape.Left := Chart1.Axes.Bottom.CalcXPosValue(XValue) - (ChartTool2.Shape.Width div 2);
  Caption := 'X: ' + floattostr(XValue) + '    Y: ' + floattostr(YValue);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  ChartTool2.PositionUnits := muPixels;
  ChartTool2.Shape.CustomPosition := true;

  Chart1.Draw;

  ChartTool2.Shape.Top := Chart1.Axes.Bottom.PosAxis + 20;
end;
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

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Mon Nov 26, 2007 10:16 am

Hi Yeray,

I will do some tests with your suggestion.

Thx for the moment !

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Mon Nov 26, 2007 1:23 pm

Hi Yeray,

works perfect !

Thx !

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Tue Nov 27, 2007 1:42 pm

Hi Yeray,

well I did some extra tests and it works. But one think is a problem .. If I enable the annotation for displaying the text the CPU usage is very high. I have a dual core mobile cpu and one cpu is at 100% while moving the cursor tool.

Do you have a solution that is less cpu hungry :? ?

Messie
Newbie
Newbie
Posts: 34
Joined: Wed Apr 13, 2005 4:00 am
Location: Goettingen, Germany

Post by Messie » Tue Nov 27, 2007 2:51 pm

Probier mal, ob Du das CursorTool mit Pfeiltasten bewegen kannst. Wenn Du mit der Maus arbeitest, wird das OnMouseOver mit einigen hundert Hz gefeuert. Dazu wird jedesmal der Wert rausgesucht -> macht den Rechner langsam.
Wenn Du das mit Tasten machst, kommt da höchstens Deine Wiederholrate raus.

Grüße, Ulfert

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Tue Nov 27, 2007 3:36 pm

Tja aber die Bedienung erfolgt nunmal mit der Maus.
Insofern habe ich da ein kleines Problem fürchte ich.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 27, 2007 5:42 pm

Hello Messie and moelski,

We would appreciate if you posted your messages in those forums in English so that the most part of users can understand them and benefit from the knowledge base they are. We don't have any inconvenient if you post your messages in German and English either.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Tue Nov 27, 2007 5:49 pm

Hi Narcis,

well me latest question is still in english.

And I will write my next posts in english only.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 27, 2007 6:13 pm

Hi Dominik,
well me latest question is still in english.
Yes, I've done tests with Core Duo and Pentium IV CPUs and haven't been able to reproduce the issue. Tomorrow I'll try with a dual core machine. Should I follow any specific step to reproduce the problem here? Can you reproduce it with the example at All Features\Welcome!\Tools\Cursor\Synchronizing Two in the features demo?
And I will write my next posts in english only.
Thanks!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Tue Nov 27, 2007 10:06 pm

Hi Narcis,

I can send you a simple demo which has a lot of CPU load at my laptop.
I add an entry here is I uploaded it to your server.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Nov 28, 2007 8:36 am

Hi Dominik,

I'm not able to reproduce it with a Pentium Dual Core CPU either. Where have you posted your example, I can't find it.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

moelski
Advanced
Posts: 212
Joined: Mon Apr 23, 2007 12:00 am
Location: Germany
Contact:

Post by moelski » Fri Nov 30, 2007 7:29 am

Hi Narcis,

Sorry had no time yesterday for write a demo.
But I have uploaded it now: "Received Mess Demo Simple.rar Content Type application/octet-stream Length 16618"

If I make the window very large and move the cursor (and check "Show values"), then the cpu usage is very high.

Maybe I do something generally wrong ?!

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 30, 2007 10:18 am

Hi Dominik,

Thanks for the example project but I haven't been able to reproduce the problem here. I tested this in a Dual Core and Pentium IV machines without success. Have you been able to reproduce this in other machines?

It could be a graphic problem at your end. You could try updating the graphic card driver or checking its configuration.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply