Page 1 of 1

### Vertical Autoresize to min/max on changing horizontal zoom

Posted: Tue Feb 22, 2011 9:49 pm
Hello

I'm very thankful for the last response and solution, but now I have another question:

is it possible to do something like a vertical autoresize to min and max values when I change the zoom? I change the zoom like this:

chart.getAxes().getBottom().setMinimum(valuemin);
chart.getAxes().getBottom().setMaximum(valuemax);

or else, how can I know the points between this horizontal values? with that I could use the same instructions to resize vertically

Thanks in advance !

### Re: Vertical Autoresize to min/max on changing horizontal zoom

Posted: Thu Feb 24, 2011 5:02 pm
Hi Miguel,

I'm afraid you'll have to calculate it manually looping your series, searching for the minimum and maximum visible values. For example:

Code: Select all

``````        tChart1.getAxes().getBottom().setMinMax(5, 15);
tChart1.paint(tChart1.getGraphics());
int firstVisible = line1.getFirstVisible();
int lastVisible = line1.getLastVisible()-1;
int minVisible = firstVisible;
int maxVisible = firstVisible;
for (int i=firstVisible;i<=lastVisible;i++)
{
if (line1.getYValues().getValue(i) < line1.getYValues().getValue(minVisible))
minVisible = i;
if (line1.getYValues().getValue(i) > line1.getYValues().getValue(maxVisible))
maxVisible = i;
}
tChart1.getAxes().getLeft().setMinMax(line1.getYValues().getValue(minVisible), line1.getYValues().getValue(maxVisible));``````

### Re: Vertical Autoresize to min/max on changing horizontal zoom

Posted: Thu Feb 24, 2011 6:51 pm
Hi Yeray

Thanks! the getFirstVisible(); function is just what I need