ColorLine onMouseOver/onClick event?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

ColorLine onMouseOver/onClick event?

Post by acastro » Mon Mar 15, 2010 10:44 am

Hi,

I would like to detect when the user's mouse is over a ColorLine, or when click it to show a tooltip. But I only found EndDragLine and DragLine, and I don't want the user move it to show the tooltip. Any Ideas?

Thanks

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

Re: ColorLine onMouseOver/onClick event?

Post by Yeray » Mon Mar 15, 2010 3:20 pm

Hi wakeup,

Have you tried with the MouseMove event with the tool clicked method?

Code: Select all

        Steema.TeeChart.Tools.ColorLine colorline1;
        Steema.TeeChart.Tools.Annotation annotation1;

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;

            Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            line1.FillSampleValues();

            colorline1 = new Steema.TeeChart.Tools.ColorLine(tChart1.Chart);
            colorline1.Axis = tChart1.Axes.Bottom;
            colorline1.Value = 10;

            annotation1 = new Steema.TeeChart.Tools.Annotation(tChart1.Chart);
            annotation1.Active = false;
            colorline1.ColorLineClickTolerance = 5;

            tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
        }

        void tChart1_MouseMove(object sender, MouseEventArgs e)
        {
            if /*(colorline1.Clicked(e.X, e.Y))*/ (Math.Abs(e.X - colorline1.Axis.CalcPosValue(colorline1.Value)) == colorline1.ColorLineClickTolerance)
            {
                annotation1.Text = "colorline1 value: " + colorline1.Value.ToString();
                annotation1.Top = e.Y;
                annotation1.Left = e.X;
                annotation1.Active = true;
                tChart1.Refresh();
            }
            else annotation1.Active = false;
        }
It seems that the colorline clicked method doesn't return the correct value, that's I used "(Math.Abs(e.X - colorline1.Axis.CalcPosValue(colorline1.Value)) == colorline1.ColorLineClickTolerance)" instead of it. Could you please confirm that the clicked method doesn't work as expected?
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

acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Re: ColorLine onMouseOver/onClick event?

Post by acastro » Mon Mar 15, 2010 4:20 pm

Sorry. My the type of my chart.MouseMove is EventHandler and not MouseEventHandler. So I can't get e.X, e.Y values...
What have I different? I'm woring with Visual studio 2008 and the the last version of teechart.net

Thanks

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

Re: ColorLine onMouseOver/onClick event?

Post by Yeray » Tue Mar 16, 2010 3:54 pm

Hi wakeup,

Are you programming on C++? Here, creating the event at designtime it looks as follows:

Code: Select all

this->tChart1->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::tChart1_MouseMove);
//...
private: System::Void tChart1_MouseMove(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
}
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

acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Re: ColorLine onMouseOver/onClick event?

Post by acastro » Wed Mar 17, 2010 7:33 am

No, I'm programming in C#
thanks!

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

Re: ColorLine onMouseOver/onClick event?

Post by Yeray » Wed Mar 17, 2010 9:39 am

Hi wakeup,

It's strange. Have you tried the code I posted above in a new testing WinForms project (File\New\Project...\Visual C#\Windows Forms Application)?
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

acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Re: ColorLine onMouseOver/onClick event?

Post by acastro » Wed Mar 17, 2010 5:24 pm

Oh! Sorry. I was using the mouseOver event instead of mouseMove. Now it runs.
But it doen't run with the colorline1.Clicked condition

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

Re: ColorLine onMouseOver/onClick event?

Post by Yeray » Thu Mar 18, 2010 1:33 pm

Hi wakeup,

Thanks, I've added it to the defect list to be fixed in future releases (TF02014736).
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