I have a line chart displaying data in the x-range of 0...360. Using the mouse I can zoom in and out on that data.
But then I programmatically set the x-axis as follows:
mChart.Axes.Bottom.Automatic = false;
mChart.Axes.Bottom.Minimum = 20;
mChart.Axes.Bottom.Maximum = 100;
After that the chart displays the x-axis as expected.
But then my problem: I can now not zoom out using the mouse anymore. The chart remains "stuck" on the range of 20...100 instead of letting me zoom out again to 0..360.
Question: How can I programmatically "zoom in" (set x-axes bounds) and still be able to zoom out again using the mouse?
Zoom Out after programmatically setting axis bounds
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Zoom Out after programmatically setting axis bounds
Sorry for the slight delay in this reply. You can try something like this:arnadan wrote:Question: How can I programmatically "zoom in" (set x-axes bounds) and still be able to zoom out again using the mouse?
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Series.Add(typeof(Line)).FillSampleValues();
tChart1.UndoneZoom += tChart1_UndoneZoom;
}
void tChart1_UndoneZoom(object sender, EventArgs e)
{
if (savedScales != null)
tChart1.Chart.RestoreScales(savedScales);
}
private Steema.TeeChart.Chart.AllAxisSavedScales savedScales;
private void button1_Click(object sender, EventArgs e)
{
if(savedScales == null)
savedScales = tChart1.Chart.SaveScales();
tChart1.Axes.Bottom.Automatic = false;
tChart1.Axes.Bottom.Minimum = 2;
tChart1.Axes.Bottom.Maximum = 10;
}
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 |