Unzoom after save and open the chart

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

Unzoom after save and open the chart

Post by acastro » Tue Nov 12, 2013 2:25 pm

In a chart, I can zoom clicking and draging right the left button, and unzoom clicking and draggin left the left button.

But if I zoom, and then I save the chart with "Export.Template.Save", and open it again but I cannot do unzoom, of the zoom done before save.

Is there any way to unzoom it? Or is it possible to unzoom programatically when opening (or before saving) the chart?

Thanks

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

Re: Unzoom after save and open the chart

Post by Sandra » Thu Nov 14, 2013 3:36 pm

Hello wakeup,

I recommend you save Bottom and Left Min/Max values, before you do zoom and you export chart as template. After, you can use values in UndoneZoom() Event to do Unzoom() in the Chart you have loaded. You can do something as next:

Code: Select all

   public Form1()
        {
            InitializeComponent();
        }

        double MinX, MaxX, MinY,MaxY, IncrementY; 
        private void Form1_Load(object sender, EventArgs e)
        {
            tChart1.Aspect.View3D = false;
            Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
          
            line1.FillSampleValues();
            tChart1.Draw();
            MinX = tChart1.Axes.Bottom.Minimum;
            MaxX= tChart1.Axes.Bottom.Maximum;
            MinY = tChart1.Axes.Left.Minimum;
            MaxY = tChart1.Axes.Left.Maximum;
        }

        private void button1_Click(object sender, EventArgs e)
        {
          tChart2.Import.Template.Load(@"TestChart1.Ten");
          tChart2.Zoom.History = true; 
          tChart2.UndoneZoom += tChart2_UndoneZoom;
        }
        void tChart2_UndoneZoom(object sender, EventArgs e)
        {
          if (tChart2.Zoom.HistorySteps != null)
          {
            tChart2.Axes.Bottom.SetMinMax(MinX, MaxX);
            tChart2.Axes.Left.SetMinMax(MinY, MaxY);
          }
          else
          {
            tChart2.Zoom.Undo();
          }
        }

 void button2_Click(object sender, EventArgs e)
        {

          tChart1.Export.Template.Save(@"TestChart1.ten"); 
        }
Could you tell us if previous code works in your end?

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