Right Mouse Button Down problems

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
rino
Newbie
Newbie
Posts: 26
Joined: Wed May 23, 2007 12:00 am

Right Mouse Button Down problems

Post by rino » Tue Mar 15, 2011 2:55 pm

In my chart , I have zoom in and out and Scroll functionality by playing with
MaxPointsPerPage and Using Page.Next Page.Previous.
I have a defect that , after user uses Right Mouse Button to scroll the chart , then the Page.Next and Page.Previous and the MaxPointsPerPage stop working untill I call Zoom.Undo()

Question:
1. Do you have a fix for this.
2. If not , how do I disable the right mouse down scrolling functionality.

Thanks

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Right Mouse Button Down problems

Post by Sandra » Wed Mar 16, 2011 3:56 pm

Hello rino,

A solution for paging WITH zooming and scrolling would be to use axis SetMinMax method to perform "paging". Something like this :

Code: Select all

        Steema.TeeChart.Styles.Line series1, series2;
        double currentmin;
        private void InitializeChart()
        {
            //Chart
            tChart1.Dock = DockStyle.Fill;
            this.tChart1.Aspect.View3D = false;
            this.tChart1.Axes.Bottom.MinorTicks.Visible = false;
            tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
            //Series
            series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            series2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            tChart1.Panel.MarginRight = 10;
            series1.FillSampleValues(30);
            series2.FillSampleValues(30);

            tChart1.Page.MaxPointsPerPage = 10;
            currentmin = tChart1.Axes.Bottom.Minimum;
            tChart1.Axes.Bottom.SetMinMax(tChart1.Axes.Bottom.Minimum, tChart1.Axes.Bottom.Minimum + 10);
            tChart1.UndoneZoom += new EventHandler(tChart1_UndoneZoom);
        }
        void tChart1_UndoneZoom(object sender, EventArgs e)
        {
            tChart1.Axes.Bottom.SetMinMax(currentmin, currentmin + 10);
        }
        private void button1_Click(object sender, EventArgs e)
        {
           tChart1.Axes.Bottom.SetMinMax(tChart1.Axes.Bottom.Minimum+10,tChart1.Axes.Bottom.Minimum+2.0*10);
            tChart1.Page.Next();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            tChart1.Axes.Bottom.SetMinMax(tChart1.Axes.Bottom.Minimum-10, tChart1.Axes.Bottom.Minimum);
            tChart1.Page.Previous();
        }
Where currentmin defines current minimum and range number or range of points you want to display. Using this approach you can control "page" via the currentmin and number of points per page via the range variable.
Could you tell us, if previous code solve your problem and works are you expected?

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

rino
Newbie
Newbie
Posts: 26
Joined: Wed May 23, 2007 12:00 am

Re: Right Mouse Button Down problems

Post by rino » Thu Mar 17, 2011 1:23 pm

Hi Sandra
Actually I do not have a problem with the zoom or page scroll .
The problem starts only after pressing right button down and dragging. After that the zoom and previous next do not work.
is there a way to cancel the right button down functionality.
Thanks.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Right Mouse Button Down problems

Post by Sandra » Thu Mar 17, 2011 3:54 pm

Hello rino,

Could you reproduce your problem using previous code? If you can reproduce the problem with previous code, please explain us step-to-step how we have to do to reproduce these here.

Thanks,
Best Regards,
Sandra Pazos / 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

rino
Newbie
Newbie
Posts: 26
Joined: Wed May 23, 2007 12:00 am

Re: Right Mouse Button Down problems

Post by rino » Mon Mar 21, 2011 12:34 pm

Hi Sandra
Again I ask , is there anyway to disable the right mouse down functionality.?
I do not want to refactor our zoom and previous , which works .
Thanks

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Right Mouse Button Down problems

Post by Sandra » Mon Mar 21, 2011 3:14 pm

Hello rino,

Sorry, I think that I didn't understand your previous post correctly. I have made a simple code, where is disabled the scroll functionality that you do with button right of mouse, in mouse down event:

Code: Select all

        Steema.TeeChart.Styles.Line series1, series2;
        double currentmin;
        private void InitializeChart()
        {
            //Chart
            tChart1.Dock = DockStyle.Fill;
            this.tChart1.Aspect.View3D = false;
            this.tChart1.Axes.Bottom.MinorTicks.Visible = false;
            tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
            //Series
            series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            series2 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            tChart1.Panel.MarginRight = 10;
            series1.FillSampleValues(30);
            series2.FillSampleValues(30);

            tChart1.Page.MaxPointsPerPage = 10;
            tChart1.Page.AutoScale = false;
            currentmin = tChart1.Axes.Bottom.Minimum;
            tChart1.Axes.Bottom.SetMinMax(tChart1.Axes.Bottom.Minimum, tChart1.Axes.Bottom.Minimum + 10);
            tChart1.MouseDown += new MouseEventHandler(tChart1_MouseDown);
            tChart1.UndoneZoom += new EventHandler(tChart1_UndoneZoom);
            tChart1.Draw();
        }

        void tChart1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                tChart1.Panning.Allow = Steema.TeeChart.ScrollModes.None;
            }
        }

        void tChart1_UndoneZoom(object sender, EventArgs e)
        {
            tChart1.Axes.Bottom.SetMinMax(currentmin, currentmin + 10);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            tChart1.Axes.Bottom.SetMinMax(tChart1.Axes.Bottom.Minimum + 10, tChart1.Axes.Bottom.Minimum + 2.0 * 10);
            tChart1.Page.Next();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            tChart1.Axes.Bottom.SetMinMax(tChart1.Axes.Bottom.Minimum - 10, tChart1.Axes.Bottom.Minimum);
            tChart1.Page.Previous();
        }
Could you please, tell us if previous code disabling the scroll your application works as you expected?

Thanks,
Best Regards,
Sandra Pazos / 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

rino
Newbie
Newbie
Posts: 26
Joined: Wed May 23, 2007 12:00 am

Re: Right Mouse Button Down problems

Post by rino » Wed Mar 23, 2011 1:26 pm

Hi Sandra
can you please explain in detail why you need to combine the SetMinMax with the Chart.Page.Next
shoudlnt Chart.Page.Next be enough ? why must you keep adjusting the min max also ?
thanks.

rino
Newbie
Newbie
Posts: 26
Joined: Wed May 23, 2007 12:00 am

Re: Right Mouse Button Down problems

Post by rino » Thu Mar 24, 2011 10:25 am

Hi

What I need is the correct way to implement 5 functionalities , zoom in, zoom out , scroll left page, scroll right page. Zoom out increases by 1 the number of bars shown and Zoom in decreases.
Until now I was using pages but if I understand correctly it is better to work only with the SetMinMax and not with page scrolling .
Is that correct ?

Thanks.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Right Mouse Button Down problems

Post by Sandra » Thu Mar 24, 2011 1:17 pm

Hello rino,
What I need is the correct way to implement 5 functionalities , zoom in, zoom out , scroll left page, scroll right page. Zoom out increases by 1 the number of bars shown and Zoom in decreases.
Until now I was using pages but if I understand correctly it is better to work only with the SetMinMax and not with page scrolling .
Is that correct ?
Ok, I have added it in wish-list with number [TF02015461] to try to inclusion it in future releases. At the moment, you can do something as next code using Zoom.Undo() before to do Page.Next and Page.Previous if you prefer, before use SetMinMax, that also is a other workaround for this problem.

Code: Select all

        private void button1_Click(object sender, EventArgs e)
        {
            tChart1.Zoom.Undo();
            tChart1.Page.Next();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            tChart1.Zoom.Undo();
            tChart1.Page.Previous();
        }
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / 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

Post Reply