Page 1 of 1

Unzoom after save and open the chart

Posted: Tue Nov 12, 2013 2:25 pm
by 15654539
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

Re: Unzoom after save and open the chart

Posted: Thu Nov 14, 2013 3:36 pm
by 10050769
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,