Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1421 - paint lockup with axis autoscaling with less than 2 unique Y values
Summary: paint lockup with axis autoscaling with less than 2 unique Y values
Status: RESOLVED FIXED
Alias: None
Product: Java TeeChart
Classification: Unclassified
Component: Axes (show other bugs)
Version: 3.2015.0108
Hardware: PC Windows
: --- major
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-28 18:02 EST by Jay Rinkel
Modified: 2016-02-17 04:49 EST (History)
1 user (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments
source code to demonstrate problem (1.26 KB, text/plain)
2016-01-28 18:02 EST, Jay Rinkel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jay Rinkel 2016-01-28 18:02:23 EST
Created attachment 540 [details]
source code to demonstrate problem

If there are less than 2 unique Y values in a series and auto scaling is set to true for the vertical axis, the chart will cause Java / Swing to lockup during a paint cycle. 

Per Yeray Alonso, on 2/19/2015 the following is the change required to fix the bug, which we verified by compiling the source code with the change:

In the sources, at com\steema\teechart\axis\Axis.java you'll find a method named maxLabelsValueWidth() ending as follows:

    private int maxLabelsValueWidth() {
        //...
        if (tmp != 0) {
            tmpResult = 0;
            int limit = 5000;

            do {
                tmpResult = Math.max(tmpResult, chart.multiLineTextWidth(labels.labelValue(tmpB)).width);

                tmpB -= tmp;
                limit -= 1;
            } while ((tmpB < tmpA) || (limit == 0));
        } else {
            tmpResult = (chart.getGraphics3D().textWidth(" ")
                    + Math.max(chart.multiLineTextWidth(
                                    labels.labelValue(tmpA)).width,
                            chart.multiLineTextWidth(labels.labelValue(tmpB)).width));
        }

        //          GetAxisLabel=oldGetAxisLabel;
       
        return tmpResult;
    }

Change it for just this:

    private int maxLabelsValueWidth() {
        //...
        double tmpC = tmp * (int) ((iMaximum - tmp) / tmp);
        tmpResult = chart.getGraphics3D().textWidth(" ")
                + Math.max(Math.max(chart.multiLineTextWidth(labels.labelValue(tmpA)).width,
                                chart.multiLineTextWidth(labels.labelValue(tmpB)).width),
                        chart.multiLineTextWidth(labels.labelValue(tmpC)).width);
       
        return tmpResult;
    }
Comment 1 yeray alonso 2016-02-17 04:49:27 EST
The code suggested was added to the production version the 19/01/2015