Axis titles are displayed off screen when using an offset

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
WST
Newbie
Newbie
Posts: 4
Joined: Thu May 08, 2014 12:00 am

Axis titles are displayed off screen when using an offset

Post by WST » Wed May 21, 2014 8:12 pm

Setting a minimum or maximum offset on a vertical axis using setMinimumOffset() or setMaximumOffset() causes the axis title to be displayed off screen until the chart is re-sized to be larger. If the maximum and minimum offsets are removed the title is displayed as expected.

When this example is loaded "Left Axis" is usually not visible until the window is re-sized. If the maximum and minimum offsets are removed "Left Axis" is displayed as expected.

Code: Select all

        Line line1 = new Line();
        line1.fillSampleValues();

        TChart chart = new TChart();
        chart.getAspect().setView3D( false );
        chart.addSeries( line1 );

        chart.getAxes().getLeft().getTitle().setText( "Left Axis" );
        chart.getAxes().getLeft().setMinimumOffset( 3 );
        chart.getAxes().getLeft().setMaximumOffset( 3 );

        JFrame f = new JFrame();
        f.add( chart );
        f.pack();
        f.setVisible( true );
Is there a workaround or bug fix for this?

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

Re: Axis titles are displayed off screen when using an offset

Post by Yeray » Fri May 23, 2014 7:52 am

Hello,

Here is what I get in TeeChart Swing. Is this the environment you are using and what you are getting?
TeeChart.jpeg
TeeChart.jpeg (44.04 KiB) Viewed 25670 times
If this is not what you are observing, please try to arrange a simple example project we can run as-is to reproduce the problem here.

Thanks in advance.
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

WST
Newbie
Newbie
Posts: 4
Joined: Thu May 08, 2014 12:00 am

Re: Axis titles are displayed off screen when using an offset

Post by WST » Fri May 23, 2014 5:11 pm

Yes that is what I am seeing. Notice that the string "Left Axis" is partially off screen. Resizing the window smaller will have is disappear further off screen. This problem does not occur when not using setMaxiumOffset and setMinimumOffset.

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

Re: Axis titles are displayed off screen when using an offset

Post by Yeray » Tue May 27, 2014 10:30 am

Hello,

I reproduced the problem here, so I've added it to the public tracker:
http://bugs.teechart.net/show_bug.cgi?id=782

And I've also found the fix for it. So the next maintenance release will include this fix.
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

WST
Newbie
Newbie
Posts: 4
Joined: Thu May 08, 2014 12:00 am

Re: Axis titles are displayed off screen when using an offset

Post by WST » Tue May 27, 2014 6:21 pm

Thanks for the information. When will the next maintenance release be? Is there a workaround we can use for this issue now?

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

Re: Axis titles are displayed off screen when using an offset

Post by Yeray » Wed May 28, 2014 8:23 am

Hello,
WST wrote:When will the next maintenance release be?
I'm afraid I can't tell you a date for the next release to be published.
WST wrote:Is there a workaround we can use for this issue now?
I'm afraid I can't think on a workaround that achieves the same result, other than avoid using setMaxiumOffset.
However, I think you own the sources and, since the fix consists in a small change, you can apply the fix yourself.
In Axis.java, find a private method called maxLabelsValueWidth. Where it says:

Code: Select all

        if ((isDateTime() && labels.getExactDateTime())
                || labels.getRoundFirstLabel()) {
            tmpA = tmp * ((iMinimum / tmp));
            tmpB = tmp * ((iMaximum / tmp));
        } else {
            tmpA = iMinimum;
            tmpB = iMaximum;
        }
It should say now:

Code: Select all

        if ((isDateTime() && labels.getExactDateTime())
                || labels.getRoundFirstLabel()) {
            tmpA = tmp * (int) ((iMinimum / tmp));
            tmpB = tmp * (int) ((iMaximum / tmp));
        } else {
            tmpA = iMinimum;
            tmpB = iMaximum;
        }
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

WST
Newbie
Newbie
Posts: 4
Joined: Thu May 08, 2014 12:00 am

Re: Axis titles are displayed off screen when using an offset

Post by WST » Wed May 28, 2014 11:37 pm

Thanks, that fixed the issue for us.

Post Reply