Vertical Autoresize to min/max on changing horizontal zoom

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
Miguel
Newbie
Newbie
Posts: 10
Joined: Mon Feb 14, 2011 12:00 am

Vertical Autoresize to min/max on changing horizontal zoom

Post by Miguel » 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 ! :)

Yeray
Site Admin
Site Admin
Posts: 8734
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

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

Post by Yeray » 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));
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Miguel
Newbie
Newbie
Posts: 10
Joined: Mon Feb 14, 2011 12:00 am

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

Post by Miguel » Thu Feb 24, 2011 6:51 pm

Hi Yeray

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

Post Reply