how to retrieve zoomed to series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Innervations
Newbie
Newbie
Posts: 6
Joined: Wed Apr 16, 2008 12:00 am
Location: Australia
Contact:

how to retrieve zoomed to series

Post by Innervations » Thu Jul 10, 2008 9:30 pm

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.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jul 11, 2008 8:59 am

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();
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply