Page 1 of 1

Axis titles are displayed off screen when using an offset

Posted: Wed May 21, 2014 8:12 pm
by 17469162
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?

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

Posted: Fri May 23, 2014 7:52 am
by yeray
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 25175 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.

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

Posted: Fri May 23, 2014 5:11 pm
by 17469162
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.

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

Posted: Tue May 27, 2014 10:30 am
by yeray
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.

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

Posted: Tue May 27, 2014 6:21 pm
by 17469162
Thanks for the information. When will the next maintenance release be? Is there a workaround we can use for this issue now?

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

Posted: Wed May 28, 2014 8:23 am
by yeray
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;
        }

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

Posted: Wed May 28, 2014 11:37 pm
by 17469162
Thanks, that fixed the issue for us.