No Mouse events in SubChart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

No Mouse events in SubChart

Post by VarMelb » Tue Mar 30, 2010 10:47 pm

Hi Support,

I hope I'm missing something here!

I have a main chart which has an added SubChartTool in the main chart tool collection and a sub chart is added to the SubChartTool.

My problem is that the sub chart does not seem to get any mouse event (eg MouseMove or MouseDown) while the main chart does. For example, if I click on the main chart the main chart gets a MouseDown event (expected) where as if I click on a sub chart the main chart gets a MouseDown event and the sub chart does not. I would have expected at least both charts to get the mouse event but preferably only the chart which is clicked on.

Is this a defect or have I got something wrong?

BTW. My real problem is that a CursorTool was added to the sub chart but it would not follow the mouse movements in the sub chart. Hence the above comments and investigation into mouse events.

thanks
Mark

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

Re: No Mouse events in SubChart

Post by Yeray » Thu Apr 01, 2010 10:43 am

Hi Mark,

Yes, the mouse events aren't fired in the SubChartTool charts. I've checked it for the Click, MouseDown, MouseUp and MouseMove events.
On the other hand, AfterDraw and Zoomed seem to work fine.

I've added it to the wish list to be implemented in future releases (TF02014771).

Anyway, you can move the cursor manually using the "parent" chart mouse events:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            CreateChart();
            CreateSubChart();
            InitializeChart();
            InitializeSubChart();
        }

        private Steema.TeeChart.TChart tChart1; //Chart1
        private Steema.TeeChart.TChart tChart2; //SubChart - Chart2
        private Steema.TeeChart.Commander chartController1;
        private Steema.TeeChart.Tools.CursorTool cursor1;
        private Boolean DragCursor;

        private void CreateChart()
        {
            tChart1 = new Steema.TeeChart.TChart();
            this.Controls.Add(tChart1);

            chartController1 = new Steema.TeeChart.Commander();
            this.Controls.Add(chartController1);
            chartController1.Chart = tChart1;

            tChart1.Dock = DockStyle.Fill;
        }

        private void CreateSubChart()
        {
            Steema.TeeChart.Tools.SubChartTool subchart1 = new Steema.TeeChart.Tools.SubChartTool(tChart1.Chart);
            tChart2 = subchart1.Charts.AddChart("Chart2");

            tChart2.Width = tChart1.Width / 2;
            tChart2.Height= tChart1.Height / 2;
        }
        
        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;

            new Steema.TeeChart.Styles.Points(tChart1.Chart);
            tChart1[0].FillSampleValues(5);

            tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
            tChart1.MouseUp += new MouseEventHandler(tChart1_MouseUp);
            tChart1.MouseMove += new MouseEventHandler(tChart1_MouseMove);
        }

        private void InitializeSubChart()
        {
            tChart2.Aspect.View3D = false;

            new Steema.TeeChart.Styles.Line(tChart2.Chart);
            tChart2[0].FillSampleValues(5);

            cursor1 = new Steema.TeeChart.Tools.CursorTool(tChart2.Chart);
            cursor1.Style = Steema.TeeChart.Tools.CursorToolStyles.Vertical;
            cursor1.Pen.Color = Color.Green;
            tChart1.Draw();
            cursor1.XValue = 2;

            DragCursor = false;
        }

        void tChart1_MouseDown(object sender, MouseEventArgs e)
        {
            if (cursor1.Clicked(e.X,e.Y) == Steema.TeeChart.Tools.CursorClicked.Vertical)
                DragCursor = true;
        }

        void tChart1_MouseUp(object sender, MouseEventArgs e)
        {
            DragCursor = false;
        }

        void tChart1_MouseMove(object sender, MouseEventArgs e)
        {
            if (DragCursor)
                cursor1.XValue = cursor1.GetHorizAxis.CalcPosPoint(e.X);
        }
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

VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Re: No Mouse events in SubChart

Post by VarMelb » Wed Apr 28, 2010 10:37 pm

Hi Yeray,

In the release notes for the latest release 4.0.2010.13050 I note that this defect [TF02014771] has not been fixed. This is disappointing. In fact there was very little in the release to encourage me to update our custom build of TChart

Would it be possible to issue me with a private fix for this defect?

regards
Mark

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: No Mouse events in SubChart

Post by Narcís » Thu Apr 29, 2010 8:56 am

Hi Mark,

We will work to identify a solution to this problem and can send you pre-release code for testing when available.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Re: No Mouse events in SubChart

Post by VarMelb » Fri Apr 30, 2010 4:34 am

Hi Narcis,

great! I (and our customer) will look forward to getting it.

regards
Mark

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

Re: No Mouse events in SubChart

Post by Yeray » Tue May 04, 2010 9:01 am

Hi Mark,

I've just sent you a mail to your registered mail with the fix for the OnMouseMove, OnMouseDown and OnMouseUp events in the SubChartTool (TF02014771).
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

VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Re: No Mouse events in SubChart

Post by VarMelb » Mon May 17, 2010 9:13 pm

Hi Yeray,

sorry for the delay I've been involved with other work.

I don't appear to have the email would you mind sending it again. Thankyou.

regards
Mark

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

Re: No Mouse events in SubChart

Post by Yeray » Tue May 18, 2010 12:21 pm

Hi Mark,

I sent it to your partner Luke, that is the registered mail into this forum.
I think I found your mail. Could you please check it again?
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

VarMelb
Newbie
Newbie
Posts: 31
Joined: Wed Feb 24, 2010 12:00 am

Re: No Mouse events in SubChart

Post by VarMelb » Wed May 19, 2010 1:40 am

Hi Yeray,

got it. Thanks.

I will post back when I have had a chance to use the code.

regards
Mark

Post Reply