Modifying HistorySteps without Zoom/Unzoom

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
amol
Advanced
Posts: 231
Joined: Tue Mar 29, 2005 5:00 am

Modifying HistorySteps without Zoom/Unzoom

Post by amol » Wed Dec 09, 2015 7:01 am

Hi Steema Support,

For zooming chart we use
tChart1.Zoom.Allow=true;
tChart1.Zoom.History=true;

So it saves all steps in historySteps automatically on every zoom.

My query is that is it possible to modify/change History step list without performing zoom/unzoom or we want to insert some value in history step without zooming.

Note- we donot want to use tChart1.Zoom.ZoomRect() for this.

Please provide any solution asap

Thanks in advance.

Thanks&Regards

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Modifying HistorySteps without Zoom/Unzoom

Post by Christopher » Wed Dec 09, 2015 9:40 am

Hello,

Yes, you can modify the values of the HistorySteps property, e.g.

Code: Select all

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;

      tChart1.Series.Add(typeof(Line)).FillSampleValues();

      tChart1.Zoom.History = true;
    }

    private void button4_Click(object sender, EventArgs e)
    {
      List<ZoomSnapshot> steps = tChart1.Zoom.HistorySteps;

      if(steps.Count > 0)
      {
        ZoomSnapshot snap = steps[0];


        //snapshot.AxesMinMax = new double[] { chart.axes.Left.Minimum,
        //                                   chart.axes.Left.Maximum,
        //                                   chart.axes.Top.Minimum,
        //                                   chart.axes.Top.Maximum,
        //                                   chart.axes.Right.Minimum,
        //                                   chart.axes.Right.Maximum,
        //                                   chart.axes.Bottom.Minimum,
        //                                   chart.axes.Bottom.Maximum };

        snap.AxesMinMax[6] = 1.5;
        snap.AxesMinMax[7] = 2.5;
      }
    }
to see this work, run the a chart with the above code, zoom twice on the chart, click the button, and then do an unzoom.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

amol
Advanced
Posts: 231
Joined: Tue Mar 29, 2005 5:00 am

Re: Modifying HistorySteps without Zoom/Unzoom

Post by amol » Wed Dec 09, 2015 12:45 pm

Thanks for prompt and valueable reply.

This code update the history steps successfully.
I have one more query in this. If we does not zoomed any time then history step count is 0.
Now if we want to add some value in history step container(when history step is zero).Is its possible?

Please suggest any solution asap.

Thanks in advance.

Thanks,

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Modifying HistorySteps without Zoom/Unzoom

Post by Christopher » Wed Dec 09, 2015 2:58 pm

amol wrote: I have one more query in this. If we does not zoomed any time then history step count is 0.
Now if we want to add some value in history step container(when history step is zero).Is its possible?
Yes. HistorySteps is a property of type List<T> where T is ZoomSnapshot: simply create a new instance of ZoomSnapshot, specify the values of the AxesMinMax array as shown and then add it to the HistorySteps using the Add method.
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply