Page 1 of 1

Modifying HistorySteps without Zoom/Unzoom

Posted: Wed Dec 09, 2015 7:01 am
by 9526439
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

Re: Modifying HistorySteps without Zoom/Unzoom

Posted: Wed Dec 09, 2015 9:40 am
by Christopher
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.

Re: Modifying HistorySteps without Zoom/Unzoom

Posted: Wed Dec 09, 2015 12:45 pm
by 9526439
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,

Re: Modifying HistorySteps without Zoom/Unzoom

Posted: Wed Dec 09, 2015 2:58 pm
by Christopher
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.