Modifies automatic limits to avoid points exactly at the borders. This only happens for limits where the corresponding value of the class array 'enlargeRange' is set: ALWAYS_ENLARGE: always enlarges the range; USUALLY_ENLARGE means that the limits should not be shifted across zero
(double[] minMax)
| 2526 | * This only happens for limits where the corresponding value of the class array 'enlargeRange' is set: |
| 2527 | * ALWAYS_ENLARGE: always enlarges the range; USUALLY_ENLARGE means that the limits should not be shifted across zero */ |
| 2528 | void enlargeRange(double[] minMax) { |
| 2529 | if (enlargeRange == null) return; |
| 2530 | for (int a=0; a<Math.min(minMax.length, enlargeRange.length); a+=2) { //for all axes (0 for x, 2 for y) |
| 2531 | boolean logAxis = a==0 ? logXAxis : logYAxis; |
| 2532 | if (logAxis) { |
| 2533 | minMax[a] = Math.log10(minMax[a]); |
| 2534 | minMax[a+1] = Math.log10(minMax[a+1]); |
| 2535 | } |
| 2536 | double range = minMax[a+1] - minMax[a]; |
| 2537 | double tmpMin = minMax[a] - 0.015*range; |
| 2538 | if (enlargeRange[a] == USUALLY_ENLARGE && !logAxis) // 'weak' enlarging: dont traverse zero |
| 2539 | minMax[a] = (tmpMin*minMax[a] <= 0) ? 0 : tmpMin; |
| 2540 | else if (enlargeRange[a] == ALWAYS_ENLARGE) |
| 2541 | minMax[a] = tmpMin; |
| 2542 | double tmpMax = minMax[a+1] + 0.015*range; |
| 2543 | if (enlargeRange[a+1] == USUALLY_ENLARGE && !logAxis) |
| 2544 | minMax[a+1] = (tmpMax*minMax[a+1] <= 0) ? 0 : tmpMax; |
| 2545 | else if (enlargeRange[a+1] == ALWAYS_ENLARGE) |
| 2546 | minMax[a+1] = tmpMax; |
| 2547 | if (logAxis) { |
| 2548 | minMax[a] = Math.pow(10, minMax[a]); |
| 2549 | minMax[a+1] = Math.pow(10, minMax[a+1]); |
| 2550 | } |
| 2551 | } |
| 2552 | } |
| 2553 | |
| 2554 | /** Returns the first font of the list that is not null, or defaultFont if both are null */ |
| 2555 | Font nonNullFont(Font font1, Font font2) { |
no test coverage detected