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 !
Vertical Autoresize to min/max on changing horizontal zoom
Re: Vertical Autoresize to min/max on changing horizontal zoom
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:
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));
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Vertical Autoresize to min/max on changing horizontal zoom
Hi Yeray
Thanks! the getFirstVisible(); function is just what I need
Thanks! the getFirstVisible(); function is just what I need