Zoom / Scroll on multiple graphs

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

Zoom / Scroll on multiple graphs

Post by LibDundas » Wed Jul 20, 2011 9:03 pm

Hello, I have searched around and read the tutorials, but I can't seem to find the answer I am looking for. I have two tcharts in one form. They both get updated at the same time with the same X-axis value.

If I scroll around in one graph, is it possible to transfer this scroll to the other graph? (same idea for zoom: if I zoom into one graph I would like to apply the same zoom level to a second graph).

Thanks!!
-Kevin

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

Re: Zoom / Scroll on multiple graphs

Post by Sandra » Fri Jul 22, 2011 9:45 am

Hello Kevin,

I have made a simple project that I think you could use in your application for achieve as you want:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        Steema.TeeChart.Styles.Points point;
        Steema.TeeChart.Styles.Line line1,line2;

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            tChart2.Aspect.View3D = false;
            line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            line2 = new Steema.TeeChart.Styles.Line(tChart2.Chart);
            line1.FillSampleValues();
            line2.DataSource = line1;
            tChart1.Zoomed += new EventHandler(tChart1_Zoomed);
            tChart1.Scroll += new EventHandler(tChart1_Scroll);
            tChart1.UndoneZoom += new EventHandler(tChart1_UndoneZoom);
        }
        void tChart1_UndoneZoom(object sender, EventArgs e)
        {
            UpdateAxes();
        }

        void tChart1_Scroll(object sender, EventArgs e)
        {
            UpdateAxes();
        }

        void tChart1_Zoomed(object sender, EventArgs e)
        {
            UpdateAxes();
        }  

        private void UpdateAxes()
        {
            tChart1.Refresh();
            tChart2.Axes.Bottom.SetMinMax(tChart1.Axes.Bottom.Minimum, tChart1.Axes.Bottom.Maximum);
        }
Could you please, check if previous code works as 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

Post Reply