Delphi 2009 / Teechart / OnMousemove

Hello,

I've been using the standaard version of Teechart within Delphi 2009 for some time now but I have a little problem with the OnMousemove event.
What I would like to do is display the value of X (left axis) which I know how to do. But the problem lies within getting the Y (bottom axis) value from a TLineseries. 
I've succesfully found out how I could get the value when the mouse hovers over the Line itself but I want it to show the YValue regardless if I'm on the Tlineseries or not (based on the XValue).

If somebody knows how to solve this problem that would be really great!

thanks in advance,

Mario Verleene
0
Mario
1/11/2009 9:12:32 PM
embarcadero.delphi.reporting 487 articles. 0 followers. Follow

4 Replies
1207 Views

Similar Articles

[PageSpeed] 58

Hello Mario,

You can do that using axes CalcPosPoint method:

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  Chart1.Title.Text[0]:='X:' + 
FloatToStr(Chart1.Axes.Bottom.CalcPosPoint(X)) +
                        ' - Y: ' + 
FloatToStr(Chart1.Axes.Left.CalcPosPoint(Y));
end;

-- 
Best Regards,

Narcís Calvet
Steema Support Central
http://support.steema.com

"Important note: If you are a TeeChart registered customer, please post your 
support questions at Steema's Support monitored Forums for customers:
http://support.steema.com  for a prompter reply."



<Mario Verleene> wrote in message news:66013@forums.codegear.com...
> Hello,
>
> I've been using the standaard version of Teechart within Delphi 2009 for 
> some time now but I have a little problem with the OnMousemove event.
> What I would like to do is display the value of X (left axis) which I know 
> how to do. But the problem lies within getting the Y (bottom axis) value 
> from a TLineseries.
> I've succesfully found out how I could get the value when the mouse hovers 
> over the Line itself but I want it to show the YValue regardless if I'm on 
> the Tlineseries or not (based on the XValue).
>
> If somebody knows how to solve this problem that would be really great!
>
> thanks in advance,
>
> Mario Verleene
0
Narcis
1/13/2009 9:34:57 AM
Hi Mario,

For completeness, you may also be interested in the interpolating example I 
posted here:

http://www.teechart.net/support/viewtopic.php?t=2828

It uses CursorTool's values but you could interpolate values from the value 
returned by CalcPosPoint.

Hope this helps!

-- 
Best Regards,

Narcís Calvet
Steema Support Central
http://support.steema.com

"Important note: If you are a TeeChart registered customer, please post your 
support questions at Steema's Support monitored Forums for customers:
http://support.steema.com  for a prompter reply."



<Mario Verleene> wrote in message news:66013@forums.codegear.com...
> Hello,
>
> I've been using the standaard version of Teechart within Delphi 2009 for 
> some time now but I have a little problem with the OnMousemove event.
> What I would like to do is display the value of X (left axis) which I know 
> how to do. But the problem lies within getting the Y (bottom axis) value 
> from a TLineseries.
> I've succesfully found out how I could get the value when the mouse hovers 
> over the Line itself but I want it to show the YValue regardless if I'm on 
> the Tlineseries or not (based on the XValue).
>
> If somebody knows how to solve this problem that would be really great!
>
> thanks in advance,
>
> Mario Verleene
0
Narcis
1/13/2009 9:48:32 AM
> {quote:title=Narcis Calvet wrote:}{quote}
> Hi Mario,
> 
> For completeness, you may also be interested in the interpolating example I 
> posted here:
> 
> http://www.teechart.net/support/viewtopic.php?t=2828
> 
> It uses CursorTool's values but you could interpolate values from the value 
> returned by CalcPosPoint.
> 
> Hope this helps!
> 
> -- 
> Best Regards,
> 
> Narcís Calvet
> Steema Support Central
> http://support.steema.com
> 
Thank you very much for this information but that's not what I'm looking for. I know how to do this. (I've searched your forums for the solution).
I Create ONE lineseries with known values for X (an array of 401 points) - which is the Bottom axis (I missed in my previous post).
The left axis : Y Values are created from values from a database base on the value of X.
Now since X Values are known and there is only one lineseries on the chart. Referenced by Series[0]. 
There must be a possibility to get the exact value of Y (left axis) based on where the cursor is on X.
I have uploaded a sample chart to show what I want :
http://www.ezr.be/chartsample/chartsample.jpg
please notice that the cursor is NOT on the lineseries but I would like to know the value regardless if I'm on the Lineseries or NOT.
in the sample jpg file above the value should be 15,4 based on where the cursor (vertical line) is.

I really hope someone can help me.

thanks in advance,

Mario Verleene

Edited by: Mario Verleene on Jan 13, 2009 2:42 AM
0
Mario
1/13/2009 10:42:56 AM
Hi Mario,

I think doing as in the interpolating example I mentioned you would achieve 
what you request. Here's an example:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart, StdCtrls, TeeLisB;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    Series1: TLineSeries;
    ChartListBox1: TChartListBox;
    procedure Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
  private
    { Private declarations }
    function InterpolateLineSeries(Series: TChartSeries; FirstIndex,
                                   LastIndex: Integer; XValue: Double): 
Double; overload;
    function InterpolateLineSeries(Series: TChartSeries;XValue: Double): 
Double; overload;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var
  i: Integer;
  XValue: Double;
begin
  XValue:=Chart1.Axes.Bottom.CalcPosPoint(X);

  With Chart1.Title.Text do
  begin
    Clear;
    for i:=0 to Chart1.SeriesCount - 1 do
        Add(Chart1[i].Name + ': Y('+FloatToStr(XValue)+')= ' +
            FloatToStr(InterpolateLineSeries(Chart1[i],XValue))+#13#10);
  end;
end;

function TForm1.InterpolateLineSeries(Series: TChartSeries; FirstIndex,
                                   LastIndex: Integer; XValue: Double): 
Double;
var
  Index: Integer;
  dx,dy: Double;
begin
  for Index:=FirstIndex to LastIndex do
    if Series.XValues.Value[Index]>XValue then break;

  //safeguard
  if (Index<1) then Index:=1
  else if (Index>=Series.Count) then Index:=Series.Count-1;

  // y=(y2-y1)/(x2-x1)*(x-x1)+y1
  dx:=Series.XValues.Value[Index] - Series.XValues.Value[Index-1];
  dy:=Series.YValues.Value[Index] - Series.YValues.Value[Index-1];

  if (dx<>0) then
    result:=dy*(XValue - Series.XValues.Value[Index-1])/dx + 
Series.YValues.Value[Index-1]
  else result:=0;
end;

function TForm1.InterpolateLineSeries(Series: TChartSeries;XValue: Double): 
Double;
begin
  result:=InterpolateLineSeries(Series,Series.FirstDisplayedIndex,Series.LastValueIndex,XValue);
end;


-- 
Best Regards,

Narcís Calvet
Steema Support Central
http://support.steema.com

"Important note: If you are a TeeChart registered customer, please post your 
support questions at Steema's Support monitored Forums for customers:
http://support.steema.com  for a prompter reply."


<Mario Verleene> wrote in message news:66657@forums.codegear.com...
> Thank you very much for this information but that's not what I'm looking 
> for. I know how to do this. (I've searched your forums for the solution).
> I Create ONE lineseries with known values for X (an array of 401 points) - 
> which is the Bottom axis (I missed in my previous post).
> The left axis : Y Values are created from values from a database base on 
> the value of X.
> Now since X Values are known and there is only one lineseries on the 
> chart. Referenced by Series[0].
> There must be a possibility to get the exact value of Y (left axis) based 
> on where the cursor is on X.
> I have uploaded a sample chart to show what I want :
> http://www.ezr.be/chartsample/chartsample.jpg
> please notice that the cursor is NOT on the lineseries but I would like to 
> know the value regardless if I'm on the Lineseries or NOT.
> in the sample jpg file above the value should be 15,4 based on where the 
> cursor (vertical line) is.
0
Narcis
1/13/2009 10:54:42 AM
Reply:

Similar Artilces:

Delphi 2009 automatic bug reports appear as Delphi.NET issues
For automatic bug reports, Delphi 2009 seems to put 'Delphi.NET' into the field for 'Project'. I will try to verify it and enter it in QC. Unfortunately this means I have to use the QC database for 'testing', but will delete my test entries if I have verified the problem. Michael Justin Michael Justin wrote: > For automatic bug reports, Delphi 2009 seems to put 'Delphi.NET' into > the field for 'Project'. AFAIK this is as expected. There is no project "RAD Studio" and so "Delphi.NET" has been choosen as proj...

Delphi 4 to Delphi 2009
Hello, Thanks to all who answered my previous question. That was a great help. And atlast our client agreed to upgrade our delphi version from 4 to Delphi 2009. *Sigh*. But before that, I need to give the estimation and cost regarding the migration to delphi 2009. Can anyone tell me is there any tool to migrate from delphi 4 to delphi 2009 or just I need to compile our Delphi 4 application in Delphi 2009. I have read from the delphi 2009 feature matrix that Delphi 1 through Delphi 2007 import is possible in delphi 2009. But i am not that sure considering the size of our application. ...

Delphi 5 To Delphi 2009
I upgraded to Delphi 2009 from D5. The install says I can install Delphi and/or C++. Delphi installed OK but I see nothing of C++. What am I missing or does my upgrade not include C++? Thanks It depends on what you bought. If you bought Delphi 2009 only, that's what you get. If you bought Delphi 2009 and C++ Builder 2009 you get both. My guess is you got Delphi 2009 only. The simplest way to verify is look your invoice - it should say I would think. You could also go to members.embarcadero.com, login, then click on my registered products. There will be a textual description of...

Delphi 2007 to Delphi 2009 Conversion
CharArrayPtr = ^CharArray; CharArray = array[0..MaxInt-1] of Char; How to convert to Delphi 2009? Bill Bill Miller wrote: > CharArrayPtr = ^CharArray; > CharArray = array[0..MaxInt-1] of Char; > > How to convert to Delphi 2009? > > Bill it depends heavelly on how it is used fearther down in your project and what you want to convert it to. I you want to simple convert the declarations ignoring UNicode altogether then the only think you have to change is the CharArray declaratin from a Char to an AnsiChar eg CharArrayPtr = ^CharArray; CharArray =...

Upgrading to Delphi 2009 from Delphi 5
I've decided it's time to upgrade to Delphi 2009 Professional from my current Delphi 5 Professional which (according to the FAQ) makes me eligible for the upgrade pricing. However, I'd just like to clarify how this process works. My concern is that my Delphi 5 is not registered on the CodeGear site and this doesn't seem to be possible as far as I can tell. When installing the trial I noticed that Delphi 2009 registers itself with your CodeGear account so does this mean that the previous version must be registered there to verify you own a Professional edition? I plan to o...

Delphi 2009 alongside Delphi 2007
Hi all, I am about to install Delphi 2009 on the same development system as Delphi 2007, before I embark is there anything I should be aware of so as to not break my Delphi 2007 installation and projects ? Thanks JT John Taylor wrote: > Hi all, > > I am about to install Delphi 2009 on the same development system > as Delphi 2007, before I embark is there anything I should be aware > of so as to not break my Delphi 2007 installation and projects ? As long as you install into a separate folder there is no problem with the two versions getting into each other...

Delphi 7 to Delphi 2009 conversion
Hello group, What do I need to do to comile the following code in D2009. Compiler error after the Else E2010: Incompatible Types 'AnsiChar' and 'Char' if isUnicode then SearchHandle := FindFirstFilew( PWideChar( fn ), FindDataW ) else SearchHandle := FindFirstFile( PAnsiChar( Ansistring( fn ) ), FindDataA ); <<<<<compiler error in the above line >>>>>>>>>>> Regards, Bryan > What do I need to do to comile the following code in D2009. > Compiler error after the Else > E2010: Incompati...

ANN: Delphi HTML Reports preview
Very simple to use - buid complex reports in 10 minutes. All you need to know - SQL, HTML, CSS. Use all power of HTML4 and CSS3 in any part of report. Features: Barcodes Multiline headers Groups Cross-tabs (any level) Transformations (cross-tab with range) Pictures (+from database) Master/Detail (any level) Supports all databases and db-libraries (writing adapter for any db-acess library takes only 5 minutes) Standalone reports - no need for delphi forms/datasets. 100% native Delhi code. All Delphi versions - from Delphi 6 to XE6 (VCL). 32/64 bit. Supports Unicode for...

is there a Delphi 2007
Would be nice to have a bundle of the latest Delphi packages. Gilbert Padilla wrote: > Would be nice to have a bundle of the latest Delphi packages. > I expect Delphi 2007 will only be on sale until the full RAD Studio 2009 edition is published, including Delphi 2009.net. W ...

Convert Delphi 7 to Delphi 2009 [Edit]
Hi! Please, I have a code done in Delphi 7... Now I want to convert Delphi 7 to Delphi 2009 but I'm having problems when compile the code. Error message: +[DCC Fatal Error] Far.dpr(9): F2063 Could not compile used unit 'System.pas'+ Please can somebody help me? Source Download (349KB): http://rapidshare.com/files/256191328/FileManager.rar.html Mirror Source Download: http://www.megaupload.com/?d=12GYLPT0 Password: delphi Thank u so much! (sorry for my bad english, it is not my native language) Edited by: loquax loquax on Jul 15, 2009 12:24 PM Sorry, bu...

ShareMem Delphi 6 --> Delphi 2009
I have just upgraded from Delphi 6 to Delphi 2009. My software uses about 20 files, plus literally dozens more plug-ins. Every project has ShareMem as its first unit and borlndmm.dll is distributed with the software. I am aware that the Borland Memory Manager was replaced to use FastMM quite some time ago. Will I have to rebuild every EXE and DLL in DElphi 2009 that uses ShareMem, or will supplying the new borlndmm.dll be enough? i.e. I would like to just update the main application EXEs and DLLs, but leave the plug-ins alone. Will this work? Thanks, Jason. -- Jason Sweby So...

ShareMem Delphi 6 --> Delphi 2009
I have just upgraded from Delphi 6 to Delphi 2009. My software uses about 20 files, plus literally dozens more plug-ins. Every project has ShareMem as its first unit and borlndmm.dll is distributed with the software. I am aware that the Borland Memory Manager was replaced to use FastMM quite some time ago. Will I have to rebuild every EXE and DLL in DElphi 2009 that uses ShareMem, or will supplying the new borlndmm.dll be enough? i.e. I would like to just update the main application EXEs and DLLs, but leave the plug-ins alone. Will this work? Thanks, Jason. -- Jason Sweby ...

Question about Delphi 2009 vs Delphi 7
Hi, I was wondering if any of you can point me to a URLs that show the most important improvements between these versions of Delphi. The objective is convincing the powers-that-pay-the-bills that moving to D2009 (that we'd have to purchase) is a better idea than moving to D7 (for which we have licenses). Fire at will! -- Saluti, Alessandro Federici ------------------------------- "I have been through some terrible things in my life, some of which actually happened." (Mark Twain) Alessandro Federici wrote: > Hi, > I was wondering if any of yo...

ShareMem Delphi 6 --> Delphi 2009
I have just upgraded from Delphi 6 to Delphi 2009. My software uses about 20 files, plus literally dozens more plug-ins. Every project has ShareMem as its first unit and borlndmm.dll is distributed with the software. I am aware that the Borland Memory Manager was replaced to use FastMM quite some time ago. Will I have to rebuild every EXE and DLL in DElphi 2009 that uses ShareMem, or will supplying the new borlndmm.dll be enough? i.e. I would like to just update the main application EXEs and DLLs, but leave the plug-ins alone. Will this work? Thanks, Jason. -- Jason Sweby ...

Web resources about - Delphi 2009 / Teechart / OnMousemove - embarcadero.delphi.reporting

Web Design - M3 Web - M3 Communications Group Website Services
M3 Communications Group Web Department - professional web services - design, development and maintenance.

软文,软文网,软文发布,软文营销门户-软文中国,中国软文营销第一门户
软文中国是专业的软文网站,提供专业的软文营销策划、软文写作发布,以及基于软文的新闻营销、网络营销推广、网络公关及网络炒作服务,是专业的企业新闻 - 商业新闻发布机构! " onMouseMove="seashowtip(this.tips,1,180)" onMouseOut=" ...

苏州大学图书馆 苏州大学图书馆
无法登陆我的图书馆? 原因1:浏览器拦截了弹出窗口,请把“启用弹出窗口拦截”禁用; 原因2:借书证号或密码输入错误,请再次输入。' value='' style='width:65px; height:14px;border:1px solid #9B9B9B' onmousem ...

浙江大学管理学院
浙江大学管理学院 实战特训——浙大EMBA戈九第六次拉练临安行 " onmousemove="boximg('http://www.som.zju.edu.cn//d/file/b74f5874508725e211eed23ff80bc00b.jpg','box_img_1',' ...

国家知识产权局专利检索
... 检索示例: 1、输入完整申请号,如键入: 02144686.5 2、已知申请号前五位为02144,应键入: 02144% 3、已知申请号中间几位为2144,应键入: %2144% 4、已知申请号不连续的几位为021和468,应键入: %021%468% " onmous ...

Harvard University - Job details
Search information technology and Internet job openings. Locate job fairs and career events. Post resumes to high tech employers.

涓浗娑傛枡鍗佸ぇ鍝佺墝-鍢夋煆涓芥紗瀹樻柟缃戠珯 鍐呭澧欐秱鏂?鐪熺煶婕?宀╃墖婕?/title>
缃戠珯澶囨锛?a arg1.onclick="null;if(arg1.onmousemove)arg1.onmousemove=null;if(arg1.onmouseover)arg1.onmouseover=null;if(arg1.ondblclick)arg1.ond ...

柳岩谢娜 揭秘美女主播的成名资本(组图)
... 500)this.width=500' align='center' hspace=10 vspace=10 onclick='javascript:AutoPicPages(event);' onmousemove='changeMouse(event);' onmouseout='removeDiv();' ...

2014中国互联网公司薪酬哪家高?今日头条“最任性”
... 500)this.width=500' align='center' hspace=10 vspace=10 onclick='javascript:AutoPicPages(event);' onmousemove='changeMouse(event);' onmouseout='removeDiv();' ...

MWV - Job details
Search information technology and Internet job openings. Locate job fairs and career events. Post resumes to high tech employers.

Resources last updated: 11/26/2015 9:47:14 PM