Page 1 of 1

Automatic bottom axes

Posted: Thu Mar 04, 2010 10:52 am
by 15655264
Hi,

I need a graph that will always show the last 15 minutes of the data. In order to achieve it on every insert i update the Minimum and the Maximum

This is the code:

DateTime endTime = DateTime.UtcNow;
DateTime startTime = endTime.Subtract(new TimeSpan(0, 15, 0));

tchart.Axes.Bottom.Minimum = endTime.ToOADate();
tchart.Axes.Bottom.Maximum = startTime.ToOADate();

Can i do it automatically ?

Also, i need the offset (tchart.Axes.Left.MaximumOffset = 50; tchart.Axes.Left.MinimumOffset = 50;) to be only on the values of the last 15 minutes.

If i set it at the beginning it won't be accurate because the minimum and the maximum of the last 15 minutes always changing.

How can i achieve it?

Thanks,
Ofer

Re: Automatic bottom axes

Posted: Fri Mar 05, 2010 8:47 am
by yeray
Hi Ofer,
oferyo wrote:Can i do it automatically ?
To do it automatically you should call this bottom axis rescale routine after adding your points.
oferyo wrote:Also, i need the offset (tchart.Axes.Left.MaximumOffset = 50; tchart.Axes.Left.MinimumOffset = 50;) to be only on the values of the last 15 minutes.

If i set it at the beginning it won't be accurate because the minimum and the maximum of the last 15 minutes always changing.
Here is another thread with an example of how you should rescale your left axis: http://www.teechart.net/support/viewtop ... f=4&t=9022

If you still have problems with it, please try to arrange a simple example project we can run as-is to reproduce the issue here.