Page 1 of 1

how to retrieve zoomed to series

Posted: Thu Jul 10, 2008 9:30 pm
by 13048887
Is it possible to determine the minimum and maximum x and y values of the data series that is displayed in the zoomed mode? When I zoom in on a section of a Fastline chart display I need to be able to calculate some summary data just on the zoomed dataset but I can't find out what region of the full data set is displayed.

Thanks for any assistance.

Posted: Fri Jul 11, 2008 8:59 am
by narcis
Hi Innervations,

Yes, you can do something like this:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();		
		}

		private Steema.TeeChart.Styles.Points points1; 

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

			points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
			
			points1.FillSampleValues();

			tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
		}

		void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			double min = points1.MaxYValue();
			double max = points1.MinYValue();

			for (int i = points1.FirstVisibleIndex; i <= points1.LastVisibleIndex; i++)
			{
				double tmp = points1.YValues[i];

				if ((tmp < min) && (tmp >= points1.GetVertAxis.Minimum))
				{
					min = tmp;
				}

				if ((tmp > max) && (tmp <= points1.GetVertAxis.Maximum))
				{
					max = tmp;
				}
			}

			label1.Text = "Min: " + min.ToString() + ", Max: " + max.ToString();
		}