Hi,
I want to set the XValue of the Vertical CursorTool when user clicks on Chart. I have DateTime Bottom Axis.
How can I do that?
(I want to read interpolated values of all series with cursortool according to "Interpolating line series" example in TeeChart .NET demo)
Thanks in advance,
Gabor Varga
Cursor Tool manual position change
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello,
How about setting the Cursor.XValue and Cursor.YValue within the TChart click event?
How about setting the Cursor.XValue and Cursor.YValue within the TChart click event?
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Hi,
I used the following code:
The problem is that Bottom axis is DateTime. CursorTool XValue must have a datetime in double.
for example:
How can I transform Cursor.Position.X to to datetime?
Best regards,
Gabor Varga
I used the following code:
Code: Select all
var
P : Point;
begin
P := TChart1.PointToClient( Cursor.Position );
CursorTool1.XValue := P.X;
for example:
Code: Select all
CursorTool1.XValue := DateTime.Now.AddDays(1).ToOADate ;
Best regards,
Gabor Varga
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello,
should do it.
Code: Select all
CursorTool1.XValue = DateTime.FromOADate(P.X);
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Hi,
[Pascal Error] WinForm.pas(556): E2010 Incompatible types: 'Double' and 'DateTime'
So, i think you don't understand what I want thanks to my poor English...
I want to move programatically the position of the CursorTool where the user on the TeeChart clicked.
I can get X, Y position of the mouse click with from Cursor.Position but it is not in correlation with Bottom axis!!
Example:
When I click left side of the TeeChart I get X = 0. But when I set CursorTool1.XValue to 0 when Bottom Axis format is DateTime the position of the CursorTool will be somewhere in the past (maybe at 1970.01.01).
|
|
|------A
|........|
|........|
|........|
|------|------|------------------------ Bottom Axis
1:00 2:00 3:00
(dots are nothing)
So, when user clicks to position "A" I can get the Position of the click in points but _not_ the datetime on the Bottom Axis (in example today 02:00).
I hope I could clarify my problem.
Best regards,
Gabor Varga
I get the following error:CursorTool1.XValue = DateTime.FromOADate(P.X);
[Pascal Error] WinForm.pas(556): E2010 Incompatible types: 'Double' and 'DateTime'
So, i think you don't understand what I want thanks to my poor English...
I want to move programatically the position of the CursorTool where the user on the TeeChart clicked.
I can get X, Y position of the mouse click with from Cursor.Position but it is not in correlation with Bottom axis!!
Example:
When I click left side of the TeeChart I get X = 0. But when I set CursorTool1.XValue to 0 when Bottom Axis format is DateTime the position of the CursorTool will be somewhere in the past (maybe at 1970.01.01).
|
|
|------A
|........|
|........|
|........|
|------|------|------------------------ Bottom Axis
1:00 2:00 3:00
(dots are nothing)
So, when user clicks to position "A" I can get the Position of the click in points but _not_ the datetime on the Bottom Axis (in example today 02:00).
I hope I could clarify my problem.
Best regards,
Gabor Varga
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hello,
Thank you for your clear explanation. Try the following:
Thank you for your clear explanation. Try the following:
Code: Select all
private void tChart1_ClickBackground(object sender, MouseEventArgs e)
{
double xvalue = tChart1.Axes.Bottom.CalcPosPoint(e.X);
cursorTool1.XValue = xvalue;
}
Thank you!
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/
Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/