Page 1 of 1

Read Zoomed Values

Posted: Sat Jun 18, 2022 12:42 pm
by 13049545
Hi Steema,

When I zoom into a chart I'd like to get the zoomed MinX , MinY, MaxX, and MaxY values and thought it would be in the Zoomed event but am finding it challenging to figure this out. Please see attached screenshots. I'm doing something wrong.

Thanks as always!
Joseph

Re: Read Zoomed Values

Posted: Tue Jul 19, 2022 9:34 am
by Pep
Hello,

using the following code works fine. Could you please check?

Code: Select all

        Steema.TeeChart.TChart _chart = new Steema.TeeChart.TChart();
        private void Form1_Load(object sender, EventArgs e)
        {
            Controls.Add(_chart);

            var line = new Steema.TeeChart.Styles.Line(_chart.Chart);
            line.XValues.DateTime = true;

            line.FillSampleValues();

            _chart.Axes.Bottom.Labels.Angle = 90;
            _chart.Zoomed += _chart_Zoomed;
        }

        private void _chart_Zoomed(object? sender, EventArgs e)
        {
            MessageBox.Show("Min YVal:" + _chart.Axes.Left.Minimum.ToString() +
                " | Max YVal:" + _chart.Axes.Left.Maximum.ToString());

            MessageBox.Show("Min XVal:" + DateTime.FromOADate(_chart.Axes.Bottom.Minimum).ToString() + 
                " | Max XVal:" + DateTime.FromOADate(_chart.Axes.Bottom.Maximum).ToString());
        }

Re: Read Zoomed Values

Posted: Tue Jul 19, 2022 8:46 pm
by 13049545
Thanks, I will try this.