Hello.
When autoscale is enabled for a y-axis, is it possible to have autoscaling (i.e. the dynamic adjustment of the y-axis max and min values), only applied based on the visible points. It seems that autoscaling is being determined based on all points in the series, not just those visible.
thanks,
Ben.
autoscaling only visible points on the TeeChart
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Ben,
In that case you can do something like this:
In that case you can do something like this:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private Steema.TeeChart.Styles.Line line1;
private void InitializeChart()
{
line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues();
tChart1.Scroll += new EventHandler(tChart1_Scroll);
tChart1.UndoneZoom += new EventHandler(tChart1_UndoneZoom);
}
void tChart1_UndoneZoom(object sender, EventArgs e)
{
tChart1.Axes.Left.Automatic = true;
}
void tChart1_Scroll(object sender, EventArgs e)
{
double min = line1.MaxYValue();
double max = line1.MinYValue();
for (int i = line1.FirstVisibleIndex; i <= line1.LastVisibleIndex; i++)
{
double tmp = line1.YValues[i];
if (tmp < min)
{
min = tmp;
}
if (tmp > max)
{
max = tmp;
}
}
tChart1.Axes.Left.SetMinMax(min, max);
}
Best Regards,
Narcís Calvet / 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 |