I Cant Get Vertical Cursor Tool To Intersect

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

I Cant Get Vertical Cursor Tool To Intersect

Post by Dave » Thu Jul 30, 2009 8:49 am

Hello

Im developing a Windows application using Visual C#.
Ive a single window with a TeeChart control called tChart1. I add a line to this chart as follows and it displays OK.

Line line1 = new Line();
line1.Add(wavelengthArray, resultArray);
tChart1.Series.Add(line1);


Ive tried to add a vertical cursor tool so that when it intersects the line I can display the intersection point
This is shown below.

public myClass
{
...
...
verticalCursor = new Steema.TeeChart.Tools.CursorTool(tChart1.Chart);
verticalCursor.FollowMouse = true;
verticalCursor.Snap = true;
verticalCursor.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;
verticalCursor.FastCursor = true;
verticalCursor.Pen.Width = 1;
verticalCursor.Pen.Color = Color.Red;
verticalCursor.Change += new CursorChangeEventHandler(verticalCursor_Change);
}


void verticalCursor_Change(object sender, CursorChangeEventArgs e) {

verticalCursor.Series = tChart1.Series[0];

// My code in here that gets the intersection point
}


The vertical cursor moves OK (it follows the mouse) but it doesnt enter the "verticalCursor_Change" function for some reason.
Is there something obvious I may not have done? Or alternatively can someone post a simple example that shows this functionality working

Thanks.

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

Re: I Cant Get Vertical Cursor Tool To Intersect

Post by Yeray » Thu Jul 30, 2009 10:38 am

Hi Dave,

The following code seems to work fine for me here:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }

        CursorTool verticalCursor;

        private void InitializeChart()
        {
            chartController1.Chart = tChart1;

            tChart1.Aspect.View3D = false;
            tChart1.Legend.Visible = false;

            Line line1 = new Line(tChart1.Chart);
            line1.FillSampleValues(100);

            verticalCursor = new CursorTool(tChart1.Chart);
            verticalCursor.FollowMouse = true;
            verticalCursor.Snap = true;
            verticalCursor.Style = CursorToolStyles.Vertical;
            verticalCursor.FastCursor = true;
            verticalCursor.Pen.Width = 1;
            verticalCursor.Pen.Color = Color.Red;
            verticalCursor.Change += new CursorChangeEventHandler(verticalCursor_Change);
        }

        void verticalCursor_Change(object sender, CursorChangeEventArgs e)
        {
            tChart1.Header.Text = e.XValue.ToString();
        }
Also you could check the example at All features\Welcome !\Chart styles\Standard\Line(Strip)\Interpolating line series

If after looking at it you still find problems with that, please, attach here a simple example solution we can run as-is to reproduce the problem here.
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

Post Reply