How to obtain largest Left Axis (y-axis) label?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

How to obtain largest Left Axis (y-axis) label?

Post by Dave » Fri Jan 04, 2019 5:11 pm

Dear Support

My chart is being updated about 10 times per second. The values displayed in the left axis are integers and can sometimes vary quite a lot. Is there an easy way to obtain the largest DISPLAYED label in the left axis. Note its not the largest left-axis value Im interested in because that may not be displayed.

If you check the attached image the largest displayed left axis label is 3,600. However that could drop to say 850 which would change the position of the bottom chart relative to the top image.


many thanks

Dave
Attachments
tChartImage.PNG
tChartImage.PNG (67 KiB) Viewed 9578 times

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to obtain largest Left Axis (y-axis) label?

Post by Christopher » Mon Jan 07, 2019 7:54 am

Hello Dave,
Dave wrote:
Fri Jan 04, 2019 5:11 pm
My chart is being updated about 10 times per second. The values displayed in the left axis are integers and can sometimes vary quite a lot. Is there an easy way to obtain the largest DISPLAYED label in the left axis. Note its not the largest left-axis value Im interested in because that may not be displayed.
You should be able to use the Axis.Maximum property, as this displays the maximum value of the drawn axis. An example of this would be the following, where we set the left axis to a maximum value 200 units below the actual maximum, but still the actual (drawn) value is calculated in the Maximum property, e.g.

Code: Select all

		private void InitializeChart()
		{
			Line line = new Line(tChart1.Chart);

			line.FillSampleValues();

			tChart1.Axes.Left.SetMinMax(line.YValues.Minimum, line.YValues.Maximum - 200);
		}

		private void button2_Click(object sender, EventArgs e)
		{
			MessageBox.Show(tChart1.Axes.Left.Maximum.ToString());
		}
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

Dave
Advanced
Posts: 139
Joined: Mon Sep 22, 2008 12:00 am

Re: How to obtain largest Left Axis (y-axis) label?

Post by Dave » Mon Jan 07, 2019 8:09 am

Thanks Chris!

Post Reply