1 | if (last > axisMax) {↵ | | 1 | if (first < axisMin) {↵
|
2 | // this is the last period, but it is only partially visible ↵ | | 2 | // this is the first period, but it is only partially visible ↵
|
3 | // so check that the label will fit before displaying it...↵ | | 3 | // so check that the label will fit before displaying it...↵
|
4 | Rectangle2D bb = TextUtilities.getTextBounds(label, g2, ↵ | | 4 | Rectangle2D bb = TextUtilities.getTextBounds(label, g2, ↵
|
5 | g2.getFontMetrics());↵ | | 5 | g2.getFontMetrics());↵
|
6 | if ((x + bb.getWidth() / 2) > dataArea.getMaxX()) {↵ | | 6 | if ((x - bb.getWidth() / 2) < dataArea.getX()) {↵
|
7 | float xstart = (float) valueToJava2D(Math.max(first, ↵ | | 7 | float xlast = (float) valueToJava2D(Math.min(last, ↵
|
8 | axisMin), dataArea, edge);↵ | | 8 | axisMax), dataArea, edge);↵
|
9 | if (bb.getWidth() < (dataArea.getMaxX() - xstart)) {↵ | | 9 | if (bb.getWidth() < (xlast - dataArea.getX())) {↵
|
10 | x = ((float) dataArea.getMaxX() + xstart) / 2.0f; ↵ | | 10 | x = (xlast + (float) dataArea.getX()) / 2.0f; ↵
|
11 | }↵ | | 11 | }↵
|
12 | else {↵ | | 12 | else {↵
|
13 | label = null;↵ | | 13 | label = null;↵
|
14 | }↵ | | 14 | }↵
|
15 | }↵ | | 15 | }↵
|
| | | 16 | ↵
|
16 | } | | 17 | }
|