Hi Team,
I've got a question regarding the cursor Tool:
Is it possible to snap between x-values and get the y-value of every series in the chart?
For example:
- there are 3 line-series in the Chart and you add 1 cursor
- these 3 line-series got the same X-values but different Y-values
- now you want to jump along the X-values and mark the assigned Y-value of each line-series
- so with 3 line-series we would have 1 cursor and 3 marks on it
Thank you in advance!
Best regards,
Florian
TeeChart Pro Cursor
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: TeeChart Pro Cursor
Hello,
first, many apologies for the lateness of this reply.
To answer your question: yes, I think this should be possible, and I attach a code example which does most of what you ask.
first, many apologies for the lateness of this reply.
To answer your question: yes, I think this should be possible, and I attach a code example which does most of what you ask.
Code: Select all
Line _line1 = new Line(), _line2 = new Line(), _line3 = new Line();
CursorTool _cursorTool = new CursorTool();
private void InitializeChart()
{
void _cursorTool_SnapChange(object sender, CursorChangeEventArgs e)
{
if(e.SnapPoint > -1)
{
var values = "Line1 YValue: " + _line1.YValues[e.SnapPoint] + Environment.NewLine;
values += "Line2 YValue: " + _line2.YValues[e.SnapPoint] + Environment.NewLine;
values += "Line3 YValue: " + _line3.YValues[e.SnapPoint] + Environment.NewLine;
tChart1.Header.Text = values;
}
}
tChart1.Series.Add(_line1).FillSampleValues();
tChart1.Series.Add(_line2).FillSampleValues();
tChart1.Series.Add(_line3).FillSampleValues();
tChart1.Tools.Add(_cursorTool);
_cursorTool.Series = _line1;
_cursorTool.Style = CursorToolStyles.Vertical;
_cursorTool.Snap = true;
_cursorTool.SnapChange += _cursorTool_SnapChange;
_cursorTool.FollowMouse = true;
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 12
- Joined: Mon Apr 08, 2019 12:00 am
Re: TeeChart Pro Cursor
Hi Christopher,
thank you for your help, but is it maybe possible to post the code in VB.NET again?
Thanks a lot!
thank you for your help, but is it maybe possible to post the code in VB.NET again?
Thanks a lot!
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: TeeChart Pro Cursor
Hello,
Of course, here you are:LebbingUser wrote: ↑Wed Apr 24, 2019 2:07 pmthank you for your help, but is it maybe possible to post the code in VB.NET again?
Code: Select all
Private _line1 As Line = New Line(), _line2 As Line = New Line(), _line3 As Line = New Line()
Private _cursorTool As CursorTool = New CursorTool()
Private Sub InitializeChart()
TChart1.Series.Add(_line1).FillSampleValues()
TChart1.Series.Add(_line2).FillSampleValues()
TChart1.Series.Add(_line3).FillSampleValues()
TChart1.Tools.Add(_cursorTool)
_cursorTool.Series = _line1
_cursorTool.Style = CursorToolStyles.Vertical
_cursorTool.Snap = True
AddHandler _cursorTool.SnapChange, AddressOf _cursorTool_SnapChange
_cursorTool.FollowMouse = True
End Sub
Private Sub _cursorTool_SnapChange(ByVal sender As Object, ByVal e As CursorChangeEventArgs)
If e.SnapPoint > -1 Then
Dim values = "Line1 YValue: " & _line1.YValues(e.SnapPoint).ToString() + Environment.NewLine
values += "Line2 YValue: " & _line2.YValues(e.SnapPoint).ToString() + Environment.NewLine
values += "Line3 YValue: " & _line3.YValues(e.SnapPoint).ToString() + Environment.NewLine
TChart1.Header.Text = values
End If
End Sub
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 12
- Joined: Mon Apr 08, 2019 12:00 am
Re: TeeChart Pro Cursor
Hi Christopher,
that works fine!
Perfect, thank you very much for your quick help!
Best regards!
that works fine!
Perfect, thank you very much for your quick help!
Best regards!