+ * Rather than computing the string bounds of every tick on the axis, we + * just look at two values: the lower bound and the upper bound for the + * axis. These two values will usually be representative. + * + * @param g2 the graphics device. + * @param unit the tick unit to use for calculation. + * + * @return The estimated maximum width of the tick labels. + */ + private double estimateMaximumTickLabelHeight(Graphics2D g2, + DateTickUnit unit) { + + RectangleInsets tickLabelInsets = getTickLabelInsets(); + return estimateMaximumTickLabelDimension(g2, unit, !isVerticalTickLabels(), tickLabelInsets.getTop() + tickLabelInsets.getBottom()); } @@ -1555,6 +1520,30 @@ protected List refreshTicksHorizontal(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) { + DateTickUnit unit = getTickUnit(); + Date tickDate = calculateLowestVisibleTickValue(unit); + return refreshTicksRefactored(g2, dataArea, edge, unit, tickDate, TextAnchor.CENTER_RIGHT, RectangleEdge.TOP, Math.PI, - Math.PI, TextAnchor.BOTTOM_CENTER, TextAnchor.TOP_CENTER); + + } + + /** + * Recalculates the ticks for the date axis. + * + * @param g2 the graphics device. + * @param dataArea the area in which the plot should be drawn. + * @param edge the location of the axis. + * + * @return A list of ticks. + */ + protected List refreshTicksVertical(Graphics2D g2, + Rectangle2D dataArea, RectangleEdge edge) { + + DateTickUnit unit = getTickUnit(); + Date tickDate = calculateLowestVisibleTickValue(unit); + return refreshTicksRefactored(g2, dataArea, edge, unit, tickDate, TextAnchor.BOTTOM_CENTER, RectangleEdge.LEFT, - Math.PI, Math.PI, TextAnchor.CENTER_RIGHT, TextAnchor.CENTER_LEFT); + } + + private List refreshTicksRefactored(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge, DateTickUnit unit, Date tickDate, TextAnchor originAnchor, RectangleEdge rectangleEdge, double pi, double pi1, TextAnchor oneCenter, TextAnchor otherCenter) { List result = new java.util.ArrayList(); Font tickLabelFont = getTickLabelFont(); @@ -1564,8 +1553,6 @@ selectAutoTickUnit(g2, dataArea, edge); } - DateTickUnit unit = getTickUnit(); - Date tickDate = calculateLowestVisibleTickValue(unit); Date upperDate = getMaximumDate(); boolean hasRolled = false; @@ -1596,39 +1583,7 @@ if (!isHiddenValue(tickDate.getTime())) { // work out the value, label and position - String tickLabel; - DateFormat formatter = getDateFormatOverride(); - if (formatter != null) { - tickLabel = formatter.format(tickDate); - } - else { - tickLabel = this.tickUnit.dateToString(tickDate); - } - TextAnchor anchor, rotationAnchor; - double angle = 0.0; - if (isVerticalTickLabels()) { - anchor = TextAnchor.CENTER_RIGHT; - rotationAnchor = TextAnchor.CENTER_RIGHT; - if (edge == RectangleEdge.TOP) { - angle = Math.PI / 2.0; - } - else { - angle = -Math.PI / 2.0; - } - } - else { - if (edge == RectangleEdge.TOP) { - anchor = TextAnchor.BOTTOM_CENTER; - rotationAnchor = TextAnchor.BOTTOM_CENTER; - } - else { - anchor = TextAnchor.TOP_CENTER; - rotationAnchor = TextAnchor.TOP_CENTER; - } - } - - Tick tick = new DateTick(tickDate, tickLabel, anchor, - rotationAnchor, angle); + Tick tick = getTickRefreshed(originAnchor, edge, rectangleEdge, pi, pi1, oneCenter, otherCenter, tickDate); result.add(tick); hasRolled = false; @@ -1658,61 +1613,9 @@ } return result; - - } - - /** - * Recalculates the ticks for the date axis. - * - * @param g2 the graphics device. - * @param dataArea the area in which the plot should be drawn. - * @param edge the location of the axis. - * - * @return A list of ticks. - */ - protected List refreshTicksVertical(Graphics2D g2, - Rectangle2D dataArea, RectangleEdge edge) { - - List result = new java.util.ArrayList(); - - Font tickLabelFont = getTickLabelFont(); - g2.setFont(tickLabelFont); - - if (isAutoTickUnitSelection()) { - selectAutoTickUnit(g2, dataArea, edge); - } - DateTickUnit unit = getTickUnit(); - Date tickDate = calculateLowestVisibleTickValue(unit); - Date upperDate = getMaximumDate(); - - boolean hasRolled = false; - while (tickDate.before(upperDate)) { - - // could add a flag to make the following correction optional... - if (!hasRolled) { - tickDate = correctTickDateForPosition(tickDate, unit, - this.tickMarkPosition); } - long lowestTickTime = tickDate.getTime(); - long distance = unit.addToDate(tickDate, this.timeZone).getTime() - - lowestTickTime; - int minorTickSpaces = getMinorTickCount(); - if (minorTickSpaces <= 0) { - minorTickSpaces = unit.getMinorTickCount(); - } - for (int minorTick = 1; minorTick < minorTickSpaces; minorTick++) { - long minorTickTime = lowestTickTime - distance - * minorTick / minorTickSpaces; - if (minorTickTime > 0 && getRange().contains(minorTickTime) - && (!isHiddenValue(minorTickTime))) { - result.add(new DateTick(TickType.MINOR, - new Date(minorTickTime), "", TextAnchor.TOP_CENTER, - TextAnchor.CENTER, 0.0)); - } - } - if (!isHiddenValue(tickDate.getTime())) { - // work out the value, label and position + private Tick getTickRefreshed(TextAnchor originAnchor, RectangleEdge edge, RectangleEdge top, double pi, double PI, TextAnchor oneCenter, TextAnchor otherCenter, Date tickDate) { String tickLabel; DateFormat formatter = getDateFormatOverride(); if (formatter != null) { @@ -1724,54 +1627,29 @@ TextAnchor anchor, rotationAnchor; double angle = 0.0; if (isVerticalTickLabels()) { - anchor = TextAnchor.BOTTOM_CENTER; - rotationAnchor = TextAnchor.BOTTOM_CENTER; - if (edge == RectangleEdge.LEFT) { - angle = -Math.PI / 2.0; + anchor = originAnchor; + rotationAnchor = originAnchor; + if (edge == top) { + angle = pi / 2.0; } else { - angle = Math.PI / 2.0; + angle = PI / 2.0; } } else { - if (edge == RectangleEdge.LEFT) { - anchor = TextAnchor.CENTER_RIGHT; - rotationAnchor = TextAnchor.CENTER_RIGHT; + if (edge == top) { + anchor = oneCenter; + rotationAnchor = oneCenter; } else { - anchor = TextAnchor.CENTER_LEFT; - rotationAnchor = TextAnchor.CENTER_LEFT; + anchor = otherCenter; + rotationAnchor = otherCenter; } } Tick tick = new DateTick(tickDate, tickLabel, anchor, rotationAnchor, angle); - result.add(tick); - hasRolled = false; - - long currentTickTime = tickDate.getTime(); - tickDate = unit.addToDate(tickDate, this.timeZone); - long nextTickTime = tickDate.getTime(); - for (int minorTick = 1; minorTick < minorTickSpaces; - minorTick++) { - long minorTickTime = currentTickTime - + (nextTickTime - currentTickTime) - * minorTick / minorTickSpaces; - if (getRange().contains(minorTickTime) - && (!isHiddenValue(minorTickTime))) { - result.add(new DateTick(TickType.MINOR, - new Date(minorTickTime), "", - TextAnchor.TOP_CENTER, TextAnchor.CENTER, - 0.0)); - } - } - } - else { - tickDate = unit.rollDate(tickDate, this.timeZone); - hasRolled = true; - } - } - return result; + return tick; } /** diff -burN jfreechart-original/src/main/java/org/jfree/chart/axis/DatePeriodCommon.java jfreechart-after-maintenance/src/main/java/org/jfree/chart/axis/DatePeriodCommon.java --- jfreechart-original/src/main/java/org/jfree/chart/axis/DatePeriodCommon.java 1970-01-01 01:00:00.000000000 +0100 +++ jfreechart-after-maintenance/src/main/java/org/jfree/chart/axis/DatePeriodCommon.java 2022-04-17 18:12:48.000000000 +0200 @@ -0,0 +1,49 @@ +package org.jfree.chart.axis; + +import org.jfree.chart.ui.RectangleEdge; + +import java.awt.geom.Rectangle2D; + +public abstract class DatePeriodCommon extends ValueAxis { + + /** + * Constructs a value axis. + * + * @param label the axis label ({@code null} permitted). + * @param standardTickUnits the source for standard tick units + * ({@code null} permitted). + */ + protected DatePeriodCommon(String label, TickUnitSource standardTickUnits) { + super(label, standardTickUnits); + } + + protected double getCoordinates(double value, Rectangle2D area, RectangleEdge edge, double axisMin, double axisMax) { + double result = 0.0; + if (RectangleEdge.isTopOrBottom(edge)) { + double minX = area.getX(); + double maxX = area.getMaxX(); + if (isInverted()) { + result = maxX + ((value - axisMin) / (axisMax - axisMin)) + * (minX - maxX); + } + else { + result = minX + ((value - axisMin) / (axisMax - axisMin)) + * (maxX - minX); + } + } + else if (RectangleEdge.isLeftOrRight(edge)) { + double minY = area.getMinY(); + double maxY = area.getMaxY(); + double v = ((value - axisMin) / (axisMax - axisMin)) + * (maxY - minY); + if (isInverted()) { + result = minY + v; + } + else { + result = maxY - v; + } + } + return result; + } + +} diff -burN jfreechart-original/src/main/java/org/jfree/chart/axis/LogarithmicAxis.java jfreechart-after-maintenance/src/main/java/org/jfree/chart/axis/LogarithmicAxis.java --- jfreechart-original/src/main/java/org/jfree/chart/axis/LogarithmicAxis.java 2022-03-07 09:23:25.000000000 +0100 +++ jfreechart-after-maintenance/src/main/java/org/jfree/chart/axis/LogarithmicAxis.java 2022-04-17 18:12:48.000000000 +0200 @@ -836,32 +836,7 @@ if (currentTickValue >= lowerBoundVal - SMALL_LOG_VALUE) { //tick value not below lowest data value - TextAnchor anchor; - TextAnchor rotationAnchor; - double angle = 0.0; - if (isVerticalTickLabels()) { - anchor = TextAnchor.CENTER_RIGHT; - rotationAnchor = TextAnchor.CENTER_RIGHT; - if (edge == RectangleEdge.TOP) { - angle = Math.PI / 2.0; - } - else { - angle = -Math.PI / 2.0; - } - } - else { - if (edge == RectangleEdge.TOP) { - anchor = TextAnchor.BOTTOM_CENTER; - rotationAnchor = TextAnchor.BOTTOM_CENTER; - } - else { - anchor = TextAnchor.TOP_CENTER; - rotationAnchor = TextAnchor.TOP_CENTER; - } - } - - Tick tick = new NumberTick(new Double(currentTickValue), - tickLabel, anchor, rotationAnchor, angle); + Tick tick = getTickHorizontallyRefreshed(edge, currentTickValue, tickLabel); ticks.add(tick); } } @@ -1026,34 +1001,8 @@ if (tickVal >= lowerBoundVal - SMALL_LOG_VALUE) { //tick value not below lowest data value - TextAnchor anchor; - TextAnchor rotationAnchor; - double angle = 0.0; - if (isVerticalTickLabels()) { - if (edge == RectangleEdge.LEFT) { - anchor = TextAnchor.BOTTOM_CENTER; - rotationAnchor = TextAnchor.BOTTOM_CENTER; - angle = -Math.PI / 2.0; - } - else { - anchor = TextAnchor.BOTTOM_CENTER; - rotationAnchor = TextAnchor.BOTTOM_CENTER; - angle = Math.PI / 2.0; - } - } - else { - if (edge == RectangleEdge.LEFT) { - anchor = TextAnchor.CENTER_RIGHT; - rotationAnchor = TextAnchor.CENTER_RIGHT; - } - else { - anchor = TextAnchor.CENTER_LEFT; - rotationAnchor = TextAnchor.CENTER_LEFT; - } - } //create tick object and add to list: - ticks.add(new NumberTick(new Double(tickVal), tickLabel, - anchor, rotationAnchor, angle)); + ticks.add(getTickVerticallyRefreshed(edge, tickVal, tickLabel)); } } } diff -burN jfreechart-original/src/main/java/org/jfree/chart/axis/LogAxis.java jfreechart-after-maintenance/src/main/java/org/jfree/chart/axis/LogAxis.java --- jfreechart-original/src/main/java/org/jfree/chart/axis/LogAxis.java 2022-03-07 09:23:25.000000000 +0100 +++ jfreechart-after-maintenance/src/main/java/org/jfree/chart/axis/LogAxis.java 2022-04-17 18:12:48.000000000 +0200 @@ -97,7 +97,7 @@ * * @since 1.0.7 */ -public class LogAxis extends ValueAxis { +public class LogAxis extends NumberLogCommon { /** The logarithm base. */ private double base = 10.0; @@ -120,9 +120,6 @@ /** The smallest value permitted on the axis. */ private double smallestValue = 1E-100; - /** The current tick unit. */ - private NumberTickUnit tickUnit; - /** The override number format. */ private NumberFormat numberFormatOverride; @@ -254,57 +251,6 @@ fireChangeEvent(); } - /** - * Returns the current tick unit. - * - * @return The current tick unit. - * - * @see #setTickUnit(NumberTickUnit) - */ - public NumberTickUnit getTickUnit() { - return this.tickUnit; - } - - /** - * Sets the tick unit for the axis and sends an {@link AxisChangeEvent} to - * all registered listeners. A side effect of calling this method is that - * the "auto-select" feature for tick units is switched off (you can - * restore it using the {@link ValueAxis#setAutoTickUnitSelection(boolean)} - * method). - * - * @param unit the new tick unit ({@code null} not permitted). - * - * @see #getTickUnit() - */ - public void setTickUnit(NumberTickUnit unit) { - // defer argument checking... - setTickUnit(unit, true, true); - } - - /** - * Sets the tick unit for the axis and, if requested, sends an - * {@link AxisChangeEvent} to all registered listeners. In addition, an - * option is provided to turn off the "auto-select" feature for tick units - * (you can restore it using the - * {@link ValueAxis#setAutoTickUnitSelection(boolean)} method). - * - * @param unit the new tick unit ({@code null} not permitted). - * @param notify notify listeners? - * @param turnOffAutoSelect turn off the auto-tick selection? - * - * @see #getTickUnit() - */ - public void setTickUnit(NumberTickUnit unit, boolean notify, - boolean turnOffAutoSelect) { - Args.nullNotPermitted(unit, "unit"); - this.tickUnit = unit; - if (turnOffAutoSelect) { - setAutoTickUnitSelection(false, false); - } - if (notify) { - fireChangeEvent(); - } - } /** * Returns the number format override. If this is non-{@code null}, @@ -513,47 +459,6 @@ } /** - * Draws the axis on a Java 2D graphics device (such as the screen or a - * printer). - * - * @param g2 the graphics device ({@code null} not permitted). - * @param cursor the cursor location (determines where to draw the axis). - * @param plotArea the area within which the axes and plot should be drawn. - * @param dataArea the area within which the data should be drawn. - * @param edge the axis location ({@code null} not permitted). - * @param plotState collects information about the plot ({@code null} - * permitted). - * - * @return The axis state (never {@code null}). - */ - @Override - public AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea, - Rectangle2D dataArea, RectangleEdge edge, - PlotRenderingInfo plotState) { - - AxisState state; - // if the axis is not visible, don't draw it... - if (!isVisible()) { - state = new AxisState(cursor); - // even though the axis is not visible, we need ticks for the - // gridlines... - List ticks = refreshTicks(g2, state, dataArea, edge); - state.setTicks(ticks); - return state; - } - state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge); - if (getAttributedLabel() != null) { - state = drawAttributedLabel(getAttributedLabel(), g2, plotArea, - dataArea, edge, state); - - } else { - state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); - } - createAndAddEntity(cursor, state, dataArea, edge, plotState); - return state; - } - - /** * Calculates the positions of the tick labels for the axis, storing the * results in the tick label list (ready for drawing). * @@ -863,25 +768,6 @@ } /** - * Estimates the maximum tick label height. - * - * @param g2 the graphics device. - * - * @return The maximum height. - * - * @since 1.0.7 - */ - protected double estimateMaximumTickLabelHeight(Graphics2D g2) { - RectangleInsets tickLabelInsets = getTickLabelInsets(); - double result = tickLabelInsets.getTop() + tickLabelInsets.getBottom(); - - Font tickLabelFont = getTickLabelFont(); - FontRenderContext frc = g2.getFontRenderContext(); - result += tickLabelFont.getLineMetrics("123", frc).getHeight(); - return result; - } - - /** * Estimates the maximum width of the tick labels, assuming the specified * tick unit is used. *
diff -burN jfreechart-original/src/main/java/org/jfree/chart/axis/NumberAxis.java jfreechart-after-maintenance/src/main/java/org/jfree/chart/axis/NumberAxis.java --- jfreechart-original/src/main/java/org/jfree/chart/axis/NumberAxis.java 2022-03-07 09:23:25.000000000 +0100 +++ jfreechart-after-maintenance/src/main/java/org/jfree/chart/axis/NumberAxis.java 2022-04-17 18:12:48.000000000 +0200 @@ -119,7 +119,6 @@ import org.jfree.chart.event.AxisChangeEvent; import org.jfree.chart.plot.Plot; -import org.jfree.chart.plot.PlotRenderingInfo; import org.jfree.chart.plot.ValueAxisPlot; import org.jfree.chart.ui.RectangleEdge; import org.jfree.chart.ui.RectangleInsets; @@ -140,7 +139,7 @@ * The {@code NumberAxis} class has a mechanism for automatically * selecting a tick unit that is appropriate for the current axis range. */ -public class NumberAxis extends ValueAxis implements Cloneable, Serializable { +public class NumberAxis extends NumberLogCommon implements Cloneable, Serializable { /** For serialization. */ private static final long serialVersionUID = 2805933088476185789L; @@ -178,9 +177,6 @@ */ private boolean autoRangeStickyZero; - /** The tick unit for the axis. */ - private NumberTickUnit tickUnit; - /** The override number format. */ private NumberFormat numberFormatOverride; @@ -204,7 +200,6 @@ this.rangeType = RangeType.FULL; this.autoRangeIncludesZero = DEFAULT_AUTO_RANGE_INCLUDES_ZERO; this.autoRangeStickyZero = DEFAULT_AUTO_RANGE_STICKY_ZERO; - this.tickUnit = DEFAULT_TICK_UNIT; this.numberFormatOverride = null; this.markerBand = null; } @@ -297,65 +292,6 @@ } /** - * Returns the tick unit for the axis. - *
- * Note: if the {@code autoTickUnitSelection} flag is - * {@code true} the tick unit may be changed while the axis is being - * drawn, so in that case the return value from this method may be - * irrelevant if the method is called before the axis has been drawn. - * - * @return The tick unit for the axis. - * - * @see #setTickUnit(NumberTickUnit) - * @see ValueAxis#isAutoTickUnitSelection() - */ - public NumberTickUnit getTickUnit() { - return this.tickUnit; - } - - /** - * Sets the tick unit for the axis and sends an {@link AxisChangeEvent} to - * all registered listeners. A side effect of calling this method is that - * the "auto-select" feature for tick units is switched off (you can - * restore it using the {@link ValueAxis#setAutoTickUnitSelection(boolean)} - * method). - * - * @param unit the new tick unit ({@code null} not permitted). - * - * @see #getTickUnit() - * @see #setTickUnit(NumberTickUnit, boolean, boolean) - */ - public void setTickUnit(NumberTickUnit unit) { - // defer argument checking... - setTickUnit(unit, true, true); - } - - /** - * Sets the tick unit for the axis and, if requested, sends an - * {@link AxisChangeEvent} to all registered listeners. In addition, an - * option is provided to turn off the "auto-select" feature for tick units - * (you can restore it using the - * {@link ValueAxis#setAutoTickUnitSelection(boolean)} method). - * - * @param unit the new tick unit ({@code null} not permitted). - * @param notify notify listeners? - * @param turnOffAutoSelect turn off the auto-tick selection? - */ - public void setTickUnit(NumberTickUnit unit, boolean notify, - boolean turnOffAutoSelect) { - - Args.nullNotPermitted(unit, "unit"); - this.tickUnit = unit; - if (turnOffAutoSelect) { - setAutoTickUnitSelection(false, false); - } - if (notify) { - notifyListeners(new AxisChangeEvent(this)); - } - - } - - /** * Returns the number format override. If this is non-null, then it will * be used to format the numbers on the axis. * @@ -632,53 +568,6 @@ } /** - * Draws the axis on a Java 2D graphics device (such as the screen or a - * printer). - * - * @param g2 the graphics device ({@code null} not permitted). - * @param cursor the cursor location. - * @param plotArea the area within which the axes and data should be drawn - * ({@code null} not permitted). - * @param dataArea the area within which the data should be drawn - * ({@code null} not permitted). - * @param edge the location of the axis ({@code null} not permitted). - * @param plotState collects information about the plot - * ({@code null} permitted). - * - * @return The axis state (never {@code null}). - */ - @Override - public AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea, - Rectangle2D dataArea, RectangleEdge edge, - PlotRenderingInfo plotState) { - - AxisState state; - // if the axis is not visible, don't draw it... - if (!isVisible()) { - state = new AxisState(cursor); - // even though the axis is not visible, we need ticks for the - // gridlines... - List ticks = refreshTicks(g2, state, dataArea, edge); - state.setTicks(ticks); - return state; - } - - // draw the tick marks and labels... - state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge); - - if (getAttributedLabel() != null) { - state = drawAttributedLabel(getAttributedLabel(), g2, plotArea, - dataArea, edge, state); - - } else { - state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state); - } - createAndAddEntity(cursor, state, dataArea, edge, plotState); - return state; - - } - - /** * Creates the standard tick units. *
* If you don't like these defaults, create your own instance of TickUnits @@ -742,23 +631,6 @@ } /** - * Estimates the maximum tick label height. - * - * @param g2 the graphics device. - * - * @return The maximum height. - */ - protected double estimateMaximumTickLabelHeight(Graphics2D g2) { - RectangleInsets tickLabelInsets = getTickLabelInsets(); - double result = tickLabelInsets.getTop() + tickLabelInsets.getBottom(); - - Font tickLabelFont = getTickLabelFont(); - FontRenderContext frc = g2.getFontRenderContext(); - result += tickLabelFont.getLineMetrics("123", frc).getHeight(); - return result; - } - - /** * Estimates the maximum width of the tick labels, assuming the specified * tick unit is used. *
@@ -942,10 +814,39 @@
*
* @return A list of ticks.
*/
- protected List refreshTicksHorizontal(Graphics2D g2,
- Rectangle2D dataArea, RectangleEdge edge) {
+ protected List refreshTicksHorizontal(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) {
+ return refreshTicksRefactored(g2, dataArea, edge, false);
+ }
+
+ /**
+ * Calculates the positions of the tick labels for the axis, storing the
+ * results in the tick label list (ready for drawing).
+ *
+ * @param g2 the graphics device.
+ * @param dataArea the area in which the plot should be drawn.
+ * @param edge the location of the axis.
+ *
+ * @return A list of ticks.
+ */
+ protected List refreshTicksVertical(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge) {
+ return refreshTicksRefactored(g2, dataArea, edge, true);
+ }
+
+ /**
+ * Calculates the positions of the tick labels for the axis, storing the
+ * results in the tick label list (ready for drawing).
+ *
+ * @param g2 the graphics device.
+ * @param dataArea the area in which the data should be drawn.
+ * @param edge the location of the axis.
+ * @param vertical boolean, true if vertical refresh, false if horizontal
+ *
+ * @return A list of ticks.
+ */
+ protected List refreshTicksRefactored(Graphics2D g2, Rectangle2D dataArea, RectangleEdge edge, boolean vertical) {
List result = new java.util.ArrayList();
+ if(vertical) result.clear();
Font tickLabelFont = getTickLabelFont();
g2.setFont(tickLabelFont);
@@ -983,31 +884,7 @@
else {
tickLabel = getTickUnit().valueToString(currentTickValue);
}
- TextAnchor anchor, rotationAnchor;
- double angle = 0.0;
- if (isVerticalTickLabels()) {
- anchor = TextAnchor.CENTER_RIGHT;
- rotationAnchor = TextAnchor.CENTER_RIGHT;
- if (edge == RectangleEdge.TOP) {
- angle = Math.PI / 2.0;
- }
- else {
- angle = -Math.PI / 2.0;
- }
- }
- else {
- if (edge == RectangleEdge.TOP) {
- anchor = TextAnchor.BOTTOM_CENTER;
- rotationAnchor = TextAnchor.BOTTOM_CENTER;
- }
- else {
- anchor = TextAnchor.TOP_CENTER;
- rotationAnchor = TextAnchor.TOP_CENTER;
- }
- }
-
- Tick tick = new NumberTick(new Double(currentTickValue),
- tickLabel, anchor, rotationAnchor, angle);
+ Tick tick = refreshTick(edge, vertical, currentTickValue, tickLabel);
result.add(tick);
double nextTickValue = lowestTickValue + ((i + 1) * size);
for (int minorTick = 1; minorTick < minorTickSpaces;
@@ -1027,61 +904,46 @@
}
- /**
- * Calculates the positions of the tick labels for the axis, storing the
- * results in the tick label list (ready for drawing).
- *
- * @param g2 the graphics device.
- * @param dataArea the area in which the plot should be drawn.
- * @param edge the location of the axis.
- *
- * @return A list of ticks.
- */
- protected List refreshTicksVertical(Graphics2D g2,
- Rectangle2D dataArea, RectangleEdge edge) {
- List result = new java.util.ArrayList();
- result.clear();
- Font tickLabelFont = getTickLabelFont();
- g2.setFont(tickLabelFont);
- if (isAutoTickUnitSelection()) {
- selectAutoTickUnit(g2, dataArea, edge);
+ private Tick refreshTick(RectangleEdge edge, boolean vertical, double currentTickValue, String tickLabel) {
+ if(vertical) {
+ return getTickVerticallyRefreshed(edge, currentTickValue, tickLabel);
+ } else {
+ return getTickHorizontallyRefreshed(edge, currentTickValue, tickLabel);
+ }
}
- TickUnit tu = getTickUnit();
- double size = tu.getSize();
- int count = calculateVisibleTickCount();
- double lowestTickValue = calculateLowestVisibleTickValue();
-
- if (count <= ValueAxis.MAXIMUM_TICK_COUNT) {
- int minorTickSpaces = getMinorTickCount();
- if (minorTickSpaces <= 0) {
- minorTickSpaces = tu.getMinorTickCount();
+ protected Tick getTickHorizontallyRefreshed(RectangleEdge edge, double currentTickValue, String tickLabel) {
+ TextAnchor anchor, rotationAnchor;
+ double angle = 0.0;
+ if (isVerticalTickLabels()) {
+ anchor = TextAnchor.CENTER_RIGHT;
+ rotationAnchor = TextAnchor.CENTER_RIGHT;
+ if (edge == RectangleEdge.TOP) {
+ angle = Math.PI / 2.0;
}
- for (int minorTick = 1; minorTick < minorTickSpaces; minorTick++) {
- double minorTickValue = lowestTickValue
- - size * minorTick / minorTickSpaces;
- if (getRange().contains(minorTickValue)) {
- result.add(new NumberTick(TickType.MINOR, minorTickValue,
- "", TextAnchor.TOP_CENTER, TextAnchor.CENTER,
- 0.0));
+ else {
+ angle = -Math.PI / 2.0;
}
}
-
- for (int i = 0; i < count; i++) {
- double currentTickValue = lowestTickValue + (i * size);
- String tickLabel;
- NumberFormat formatter = getNumberFormatOverride();
- if (formatter != null) {
- tickLabel = formatter.format(currentTickValue);
+ else {
+ if (edge == RectangleEdge.TOP) {
+ anchor = TextAnchor.BOTTOM_CENTER;
+ rotationAnchor = TextAnchor.BOTTOM_CENTER;
}
else {
- tickLabel = getTickUnit().valueToString(currentTickValue);
+ anchor = TextAnchor.TOP_CENTER;
+ rotationAnchor = TextAnchor.TOP_CENTER;
+ }
+ }
+ Tick tick = new NumberTick(new Double(currentTickValue),
+ tickLabel, anchor, rotationAnchor, angle);
+ return tick;
}
- TextAnchor anchor;
- TextAnchor rotationAnchor;
+ protected Tick getTickVerticallyRefreshed(RectangleEdge edge, double currentTickValue, String tickLabel) {
+ TextAnchor anchor, rotationAnchor;
double angle = 0.0;
if (isVerticalTickLabels()) {
if (edge == RectangleEdge.LEFT) {
@@ -1105,27 +967,9 @@
rotationAnchor = TextAnchor.CENTER_LEFT;
}
}
-
Tick tick = new NumberTick(new Double(currentTickValue),
tickLabel, anchor, rotationAnchor, angle);
- result.add(tick);
-
- double nextTickValue = lowestTickValue + ((i + 1) * size);
- for (int minorTick = 1; minorTick < minorTickSpaces;
- minorTick++) {
- double minorTickValue = currentTickValue
- + (nextTickValue - currentTickValue)
- * minorTick / minorTickSpaces;
- if (getRange().contains(minorTickValue)) {
- result.add(new NumberTick(TickType.MINOR,
- minorTickValue, "", TextAnchor.TOP_CENTER,
- TextAnchor.CENTER, 0.0));
- }
- }
- }
- }
- return result;
-
+ return tick;
}
/**
diff -burN jfreechart-original/src/main/java/org/jfree/chart/axis/NumberLogCommon.java jfreechart-after-maintenance/src/main/java/org/jfree/chart/axis/NumberLogCommon.java
--- jfreechart-original/src/main/java/org/jfree/chart/axis/NumberLogCommon.java 1970-01-01 01:00:00.000000000 +0100
+++ jfreechart-after-maintenance/src/main/java/org/jfree/chart/axis/NumberLogCommon.java 2022-04-17 18:12:48.000000000 +0200
@@ -0,0 +1,150 @@
+package org.jfree.chart.axis;
+
+import org.jfree.chart.event.AxisChangeEvent;
+import org.jfree.chart.plot.PlotRenderingInfo;
+import org.jfree.chart.ui.RectangleEdge;
+import org.jfree.chart.ui.RectangleInsets;
+import org.jfree.chart.util.Args;
+
+import java.awt.*;
+import java.awt.font.FontRenderContext;
+import java.awt.geom.Rectangle2D;
+import java.util.List;
+
+import static org.jfree.chart.axis.NumberAxis.DEFAULT_TICK_UNIT;
+
+public abstract class NumberLogCommon extends ValueAxis {
+
+ /** The tick unit for the axis. */
+ protected TickUnit tickUnit;
+
+ /**
+ * Constructs a value axis.
+ *
+ * @param label the axis label ({@code null} permitted).
+ * @param standardTickUnits the source for standard tick units
+ * ({@code null} permitted).
+ */
+ protected NumberLogCommon(String label, TickUnitSource standardTickUnits) {
+ super(label, standardTickUnits);
+ this.tickUnit = DEFAULT_TICK_UNIT;
+ }
+
+ /**
+ * Returns the current tick unit.
+ *
+ * @return The current tick unit.
+ *
+ * @see #setTickUnit(NumberTickUnit)
+ */
+ public TickUnit getTickUnit() {
+ return this.tickUnit;
+ }
+
+ /**
+ * Sets the tick unit for the axis and sends an {@link AxisChangeEvent} to
+ * all registered listeners. A side effect of calling this method is that
+ * the "auto-select" feature for tick units is switched off (you can
+ * restore it using the {@link ValueAxis#setAutoTickUnitSelection(boolean)}
+ * method).
+ *
+ * @param unit the new tick unit ({@code null} not permitted).
+ *
+ * @see #getTickUnit()
+ */
+ public void setTickUnit(NumberTickUnit unit) {
+ // defer argument checking...
+ setTickUnit(unit, true, true);
+ }
+
+ /**
+ * Sets the tick unit for the axis and, if requested, sends an
+ * {@link AxisChangeEvent} to all registered listeners. In addition, an
+ * option is provided to turn off the "auto-select" feature for tick units
+ * (you can restore it using the
+ * {@link ValueAxis#setAutoTickUnitSelection(boolean)} method).
+ *
+ * @param unit the new tick unit ({@code null} not permitted).
+ * @param notify notify listeners?
+ * @param turnOffAutoSelect turn off the auto-tick selection?
+ *
+ * @see #getTickUnit()
+ */
+ public void setTickUnit(NumberTickUnit unit, boolean notify,
+ boolean turnOffAutoSelect) {
+ Args.nullNotPermitted(unit, "unit");
+ this.tickUnit = unit;
+ if (turnOffAutoSelect) {
+ setAutoTickUnitSelection(false, false);
+ }
+ if (notify) {
+ fireChangeEvent();
+ }
+ }
+
+ /**
+ * Draws the axis on a Java 2D graphics device (such as the screen or a
+ * printer).
+ *
+ * @param g2 the graphics device ({@code null} not permitted).
+ * @param cursor the cursor location.
+ * @param plotArea the area within which the axes and data should be drawn
+ * ({@code null} not permitted).
+ * @param dataArea the area within which the data should be drawn
+ * ({@code null} not permitted).
+ * @param edge the location of the axis ({@code null} not permitted).
+ * @param plotState collects information about the plot
+ * ({@code null} permitted).
+ *
+ * @return The axis state (never {@code null}).
+ */
+ @Override
+ public AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea,
+ Rectangle2D dataArea, RectangleEdge edge,
+ PlotRenderingInfo plotState) {
+
+ AxisState state;
+ // if the axis is not visible, don't draw it...
+ if (!isVisible()) {
+ state = new AxisState(cursor);
+ // even though the axis is not visible, we need ticks for the
+ // gridlines...
+ List ticks = refreshTicks(g2, state, dataArea, edge);
+ state.setTicks(ticks);
+ return state;
+ }
+
+ // draw the tick marks and labels...
+ state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge);
+
+ if (getAttributedLabel() != null) {
+ state = drawAttributedLabel(getAttributedLabel(), g2, plotArea,
+ dataArea, edge, state);
+
+ } else {
+ state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state);
+ }
+ createAndAddEntity(cursor, state, dataArea, edge, plotState);
+ return state;
+
+ }
+
+ /**
+ * Estimates the maximum tick label height.
+ *
+ * @param g2 the graphics device.
+ *
+ * @return The maximum height.
+ *
+ * @since 1.0.7
+ */
+ protected double estimateMaximumTickLabelHeight(Graphics2D g2) {
+ RectangleInsets tickLabelInsets = getTickLabelInsets();
+ double result = tickLabelInsets.getTop() + tickLabelInsets.getBottom();
+
+ Font tickLabelFont = getTickLabelFont();
+ FontRenderContext frc = g2.getFontRenderContext();
+ result += tickLabelFont.getLineMetrics("123", frc).getHeight();
+ return result;
+ }
+}
diff -burN jfreechart-original/src/main/java/org/jfree/chart/axis/PeriodAxis.java jfreechart-after-maintenance/src/main/java/org/jfree/chart/axis/PeriodAxis.java
--- jfreechart-original/src/main/java/org/jfree/chart/axis/PeriodAxis.java 2022-03-07 09:23:25.000000000 +0100
+++ jfreechart-after-maintenance/src/main/java/org/jfree/chart/axis/PeriodAxis.java 2022-04-17 18:12:48.000000000 +0200
@@ -111,7 +111,7 @@
* displayed across the bottom or top of a plot, but is broken for display at
* the left or right of charts.
*/
-public class PeriodAxis extends ValueAxis
+public class PeriodAxis extends DatePeriodCommon
implements Cloneable, PublicCloneable, Serializable {
/** For serialization. */
@@ -966,35 +966,9 @@
public double valueToJava2D(double value, Rectangle2D area,
RectangleEdge edge) {
- double result = Double.NaN;
double axisMin = this.first.getFirstMillisecond();
double axisMax = this.last.getLastMillisecond();
- if (RectangleEdge.isTopOrBottom(edge)) {
- double minX = area.getX();
- double maxX = area.getMaxX();
- if (isInverted()) {
- result = maxX + ((value - axisMin) / (axisMax - axisMin))
- * (minX - maxX);
- }
- else {
- result = minX + ((value - axisMin) / (axisMax - axisMin))
- * (maxX - minX);
- }
- }
- else if (RectangleEdge.isLeftOrRight(edge)) {
- double minY = area.getMinY();
- double maxY = area.getMaxY();
- if (isInverted()) {
- result = minY + (((value - axisMin) / (axisMax - axisMin))
- * (maxY - minY));
- }
- else {
- result = maxY - (((value - axisMin) / (axisMax - axisMin))
- * (maxY - minY));
- }
- }
- return result;
-
+ return getCoordinates(value, area, edge, axisMin, axisMax);
}
/**
diff -burN jfreechart-original/src/main/java/org/jfree/chart/ChartPanel.java jfreechart-after-maintenance/src/main/java/org/jfree/chart/ChartPanel.java
--- jfreechart-original/src/main/java/org/jfree/chart/ChartPanel.java 2022-03-07 09:23:25.000000000 +0100
+++ jfreechart-after-maintenance/src/main/java/org/jfree/chart/ChartPanel.java 2022-04-17 18:12:48.000000000 +0200
@@ -219,7 +219,6 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.EventListener;
-import java.util.Iterator;
import java.util.List;
import java.util.ResourceBundle;
@@ -1403,7 +1402,7 @@
String result = null;
if (this.info != null) {
EntityCollection entities = this.info.getEntityCollection();
- if (entities != null) {
+ if ((entities != null) && (entities.getEntityCount() > 0)) {
Insets insets = getInsets();
ChartEntity entity = entities.getEntity(
(int) ((e.getX() - insets.left) / this.scaleX),
@@ -1761,6 +1760,10 @@
*/
@Override
public void mouseEntered(MouseEvent e) {
+ mouseEnteredAction();
+ }
+
+ void mouseEnteredAction() {
if (!this.ownToolTipDelaysActive) {
ToolTipManager ttm = ToolTipManager.sharedInstance();
@@ -1786,6 +1789,10 @@
*/
@Override
public void mouseExited(MouseEvent e) {
+ mouseExitedAction();
+ }
+
+ void mouseExitedAction() {
if (this.ownToolTipDelaysActive) {
// restore original tooltip dealys
ToolTipManager ttm = ToolTipManager.sharedInstance();
@@ -1806,23 +1813,27 @@
*/
@Override
public void mousePressed(MouseEvent e) {
+ mousePressedAction(e.getX(), e.getY(), e.getPoint(), e.isPopupTrigger(), e.getModifiers());
+ }
+
+ void mousePressedAction(int cursorX, int cursorY, Point cursorPoint, boolean popupTrigger, int cursorModifiers) {
if (this.chart == null) {
return;
}
Plot plot = this.chart.getPlot();
- int mods = e.getModifiers();
+ int mods = cursorModifiers;
if ((mods & this.panMask) == this.panMask) {
// can we pan this plot?
if (plot instanceof Pannable) {
Pannable pannable = (Pannable) plot;
if (pannable.isDomainPannable() || pannable.isRangePannable()) {
- Rectangle2D screenDataArea = getScreenDataArea(e.getX(),
- e.getY());
+ Rectangle2D screenDataArea = getScreenDataArea(cursorX,
+ cursorY);
if (screenDataArea != null && screenDataArea.contains(
- e.getPoint())) {
+ cursorPoint)) {
this.panW = screenDataArea.getWidth();
this.panH = screenDataArea.getHeight();
- this.panLast = e.getPoint();
+ this.panLast = cursorPoint;
setCursor(Cursor.getPredefinedCursor(
Cursor.MOVE_CURSOR));
}
@@ -1832,17 +1843,17 @@
}
}
else if (this.zoomRectangle == null) {
- Rectangle2D screenDataArea = getScreenDataArea(e.getX(), e.getY());
+ Rectangle2D screenDataArea = getScreenDataArea(cursorX, cursorY);
if (screenDataArea != null) {
- this.zoomPoint = getPointInRectangle(e.getX(), e.getY(),
+ this.zoomPoint = getPointInRectangle(cursorX, cursorY,
screenDataArea);
}
else {
this.zoomPoint = null;
}
- if (e.isPopupTrigger()) {
+ if (popupTrigger) {
if (this.popup != null) {
- displayPopupMenu(e.getX(), e.getY());
+ displayPopupMenu(cursorX, cursorY);
}
}
}
@@ -1858,7 +1869,7 @@
*
* @return A point within the rectangle.
*/
- private Point2D getPointInRectangle(int x, int y, Rectangle2D area) {
+ Point2D getPointInRectangle(int x, int y, Rectangle2D area) {
double xx = Math.max(area.getMinX(), Math.min(x, area.getMaxX()));
double yy = Math.max(area.getMinY(), Math.min(y, area.getMaxY()));
return new Point2D.Double(xx, yy);
@@ -1879,30 +1890,7 @@
// handle panning if we have a start point
if (this.panLast != null) {
- double dx = e.getX() - this.panLast.getX();
- double dy = e.getY() - this.panLast.getY();
- if (dx == 0.0 && dy == 0.0) {
- return;
- }
- double wPercent = -dx / this.panW;
- double hPercent = dy / this.panH;
- boolean old = this.chart.getPlot().isNotify();
- this.chart.getPlot().setNotify(false);
- Pannable p = (Pannable) this.chart.getPlot();
- if (p.getOrientation() == PlotOrientation.VERTICAL) {
- p.panDomainAxes(wPercent, this.info.getPlotInfo(),
- this.panLast);
- p.panRangeAxes(hPercent, this.info.getPlotInfo(),
- this.panLast);
- }
- else {
- p.panDomainAxes(hPercent, this.info.getPlotInfo(),
- this.panLast);
- p.panRangeAxes(wPercent, this.info.getPlotInfo(),
- this.panLast);
- }
- this.panLast = e.getPoint();
- this.chart.getPlot().setNotify(old);
+ mouseDraggedHandlePanning(e.getX(), e.getY(), e.getPoint());
return;
}
@@ -1920,6 +1908,22 @@
drawZoomRectangle(g2, true);
}
+ setZoomRectangle(e.getX(), e.getY(), this.zoomPoint);
+
+ // Draw the new zoom rectangle...
+ if (this.useBuffer) {
+ repaint();
+ }
+ else {
+ // with no buffer, we use XOR to draw the rectangle "over" the
+ // chart...
+ drawZoomRectangle(g2, true);
+ }
+ g2.dispose();
+
+ }
+
+ void setZoomRectangle(int x, int y, Point2D zoomPoint) {
boolean hZoom, vZoom;
if (this.orientation == PlotOrientation.HORIZONTAL) {
hZoom = this.rangeZoomable;
@@ -1930,39 +1934,54 @@
vZoom = this.rangeZoomable;
}
Rectangle2D scaledDataArea = getScreenDataArea(
- (int) this.zoomPoint.getX(), (int) this.zoomPoint.getY());
+ (int) zoomPoint.getX(), (int) zoomPoint.getY());
if (hZoom && vZoom) {
// selected rectangle shouldn't extend outside the data area...
- double xmax = Math.min(e.getX(), scaledDataArea.getMaxX());
- double ymax = Math.min(e.getY(), scaledDataArea.getMaxY());
+ double xmax = Math.min(x, scaledDataArea.getMaxX());
+ double ymax = Math.min(y, scaledDataArea.getMaxY());
this.zoomRectangle = new Rectangle2D.Double(
- this.zoomPoint.getX(), this.zoomPoint.getY(),
- xmax - this.zoomPoint.getX(), ymax - this.zoomPoint.getY());
+ zoomPoint.getX(), zoomPoint.getY(),
+ xmax - zoomPoint.getX(), ymax - zoomPoint.getY());
}
else if (hZoom) {
- double xmax = Math.min(e.getX(), scaledDataArea.getMaxX());
+ double xmax = Math.min(x, scaledDataArea.getMaxX());
this.zoomRectangle = new Rectangle2D.Double(
- this.zoomPoint.getX(), scaledDataArea.getMinY(),
- xmax - this.zoomPoint.getX(), scaledDataArea.getHeight());
+ zoomPoint.getX(), scaledDataArea.getMinY(),
+ xmax - zoomPoint.getX(), scaledDataArea.getHeight());
}
else if (vZoom) {
- double ymax = Math.min(e.getY(), scaledDataArea.getMaxY());
+ double ymax = Math.min(y, scaledDataArea.getMaxY());
this.zoomRectangle = new Rectangle2D.Double(
- scaledDataArea.getMinX(), this.zoomPoint.getY(),
- scaledDataArea.getWidth(), ymax - this.zoomPoint.getY());
+ scaledDataArea.getMinX(), zoomPoint.getY(),
+ scaledDataArea.getWidth(), ymax - zoomPoint.getY());
+ }
}
- // Draw the new zoom rectangle...
- if (this.useBuffer) {
- repaint();
+ void mouseDraggedHandlePanning(int x, int y, Point point) {
+ double dx = x - this.panLast.getX();
+ double dy = y - this.panLast.getY();
+ if (dx == 0.0 && dy == 0.0) {
+ return;
+ }
+ double wPercent = -dx / this.panW;
+ double hPercent = dy / this.panH;
+ boolean old = this.chart.getPlot().isNotify();
+ this.chart.getPlot().setNotify(false);
+ Pannable p = (Pannable) this.chart.getPlot();
+ if (p.getOrientation() == PlotOrientation.VERTICAL) {
+ p.panDomainAxes(wPercent, this.info.getPlotInfo(),
+ this.panLast);
+ p.panRangeAxes(hPercent, this.info.getPlotInfo(),
+ this.panLast);
}
else {
- // with no buffer, we use XOR to draw the rectangle "over" the
- // chart...
- drawZoomRectangle(g2, true);
+ p.panDomainAxes(hPercent, this.info.getPlotInfo(),
+ this.panLast);
+ p.panRangeAxes(wPercent, this.info.getPlotInfo(),
+ this.panLast);
}
- g2.dispose();
-
+ this.panLast = point;
+ this.chart.getPlot().setNotify(old);
}
/**
@@ -1975,6 +1994,11 @@
@Override
public void mouseReleased(MouseEvent e) {
+ mouseReleasedAction(e.getX(), e.getY(), e.isPopupTrigger(), this.zoomPoint);
+
+ }
+
+ void mouseReleasedAction(int x, int y, boolean popupTrigger, Point2D zoomPoint) {
// if we've been panning, we need to reset now that the mouse is
// released...
if (this.panLast != null) {
@@ -1993,48 +2017,17 @@
vZoom = this.rangeZoomable;
}
- boolean zoomTrigger1 = hZoom && Math.abs(e.getX()
- - this.zoomPoint.getX()) >= this.zoomTriggerDistance;
- boolean zoomTrigger2 = vZoom && Math.abs(e.getY()
- - this.zoomPoint.getY()) >= this.zoomTriggerDistance;
+ boolean zoomTrigger1 = hZoom && Math.abs(x
+ - zoomPoint.getX()) >= this.zoomTriggerDistance;
+ boolean zoomTrigger2 = vZoom && Math.abs(y
+ - zoomPoint.getY()) >= this.zoomTriggerDistance;
if (zoomTrigger1 || zoomTrigger2) {
- if ((hZoom && (e.getX() < this.zoomPoint.getX()))
- || (vZoom && (e.getY() < this.zoomPoint.getY()))) {
+ if ((hZoom && (x < zoomPoint.getX()))
+ || (vZoom && (y < zoomPoint.getY()))) {
restoreAutoBounds();
}
else {
- double x, y, w, h;
- Rectangle2D screenDataArea = getScreenDataArea(
- (int) this.zoomPoint.getX(),
- (int) this.zoomPoint.getY());
- double maxX = screenDataArea.getMaxX();
- double maxY = screenDataArea.getMaxY();
- // for mouseReleased event, (horizontalZoom || verticalZoom)
- // will be true, so we can just test for either being false;
- // otherwise both are true
- if (!vZoom) {
- x = this.zoomPoint.getX();
- y = screenDataArea.getMinY();
- w = Math.min(this.zoomRectangle.getWidth(),
- maxX - this.zoomPoint.getX());
- h = screenDataArea.getHeight();
- }
- else if (!hZoom) {
- x = screenDataArea.getMinX();
- y = this.zoomPoint.getY();
- w = screenDataArea.getWidth();
- h = Math.min(this.zoomRectangle.getHeight(),
- maxY - this.zoomPoint.getY());
- }
- else {
- x = this.zoomPoint.getX();
- y = this.zoomPoint.getY();
- w = Math.min(this.zoomRectangle.getWidth(),
- maxX - this.zoomPoint.getX());
- h = Math.min(this.zoomRectangle.getHeight(),
- maxY - this.zoomPoint.getY());
- }
- Rectangle2D zoomArea = new Rectangle2D.Double(x, y, w, h);
+ Rectangle2D zoomArea = getZoomArea(hZoom, vZoom, zoomPoint, this.zoomRectangle);
zoom(zoomArea);
}
this.zoomPoint = null;
@@ -2056,12 +2049,47 @@
}
- else if (e.isPopupTrigger()) {
+ else if (popupTrigger) {
if (this.popup != null) {
- displayPopupMenu(e.getX(), e.getY());
+ displayPopupMenu(x, y);
+ }
}
}
+ Rectangle2D getZoomArea(boolean hZoom, boolean vZoom, Point2D zoomPoint, Rectangle2D zoomRectangle) {
+ double x, y, w, h;
+ Rectangle2D screenDataArea = getScreenDataArea(
+ (int) zoomPoint.getX(),
+ (int) zoomPoint.getY());
+ double maxX = screenDataArea.getMaxX();
+ double maxY = screenDataArea.getMaxY();
+ // for mouseReleased event, (horizontalZoom || verticalZoom)
+ // will be true, so we can just test for either being false;
+ // otherwise both are true
+ if (! vZoom) {
+ x = zoomPoint.getX();
+ y = screenDataArea.getMinY();
+ w = Math.min(zoomRectangle.getWidth(),
+ maxX - zoomPoint.getX());
+ h = screenDataArea.getHeight();
+ }
+ else if (! hZoom) {
+ x = screenDataArea.getMinX();
+ y = zoomPoint.getY();
+ w = screenDataArea.getWidth();
+ h = Math.min(zoomRectangle.getHeight(),
+ maxY - zoomPoint.getY());
+ }
+ else {
+ x = zoomPoint.getX();
+ y = zoomPoint.getY();
+ w = Math.min(zoomRectangle.getWidth(),
+ maxX - zoomPoint.getX());
+ h = Math.min(zoomRectangle.getHeight(),
+ maxY - zoomPoint.getY());
+ }
+ Rectangle2D zoomArea = new Rectangle2D.Double(x, y, w, h);
+ return zoomArea;
}
/**
@@ -2685,12 +2713,7 @@
* @throws IOException if there is an I/O error.
*/
public void doSaveAs() throws IOException {
- JFileChooser fileChooser = new JFileChooser();
- fileChooser.setCurrentDirectory(this.defaultDirectoryForSaveAs);
- FileNameExtensionFilter filter = new FileNameExtensionFilter(
- localizationResources.getString("PNG_Image_Files"), "png");
- fileChooser.addChoosableFileFilter(filter);
- fileChooser.setFileFilter(filter);
+ JFileChooser fileChooser = createFileChooser("PNG_Image_Files", "png");
int option = fileChooser.showSaveDialog(this);
if (option == JFileChooser.APPROVE_OPTION) {
@@ -2711,37 +2734,13 @@
* if the JFreeSVG library is on the classpath...if this library is not
* present, the method will fail.
*/
- private void saveAsSVG(File f) throws IOException {
+ void saveAsSVG(File f) throws IOException {
File file = f;
if (file == null) {
- JFileChooser fileChooser = new JFileChooser();
- fileChooser.setCurrentDirectory(this.defaultDirectoryForSaveAs);
- FileNameExtensionFilter filter = new FileNameExtensionFilter(
- localizationResources.getString("SVG_Files"), "svg");
- fileChooser.addChoosableFileFilter(filter);
- fileChooser.setFileFilter(filter);
+ JFileChooser fileChooser = createFileChooser("SVG_Files", "svg");
int option = fileChooser.showSaveDialog(this);
- if (option == JFileChooser.APPROVE_OPTION) {
- String filename = fileChooser.getSelectedFile().getPath();
- if (isEnforceFileExtensions()) {
- if (!filename.endsWith(".svg")) {
- filename = filename + ".svg";
- }
- }
- file = new File(filename);
- if (file.exists()) {
- String fileExists = localizationResources.getString(
- "FILE_EXISTS_CONFIRM_OVERWRITE");
- int response = JOptionPane.showConfirmDialog(this,
- fileExists,
- localizationResources.getString("Save_as_SVG"),
- JOptionPane.OK_CANCEL_OPTION);
- if (response == JOptionPane.CANCEL_OPTION) {
- file = null;
- }
- }
- }
+ file = saveFile(option, fileChooser, ".svg", file, "Save_as_SVG");
}
if (file != null) {
@@ -2766,6 +2765,43 @@
}
}
+ File saveFile(int option, JFileChooser fileChooser, String suffix, File file, String saveAs) {
+ if (option == JFileChooser.APPROVE_OPTION) {
+ String filename = fileChooser.getSelectedFile().getPath();
+ if (isEnforceFileExtensions()) {
+ if (!filename.endsWith(suffix)) {
+ filename = filename + suffix;
+ }
+ }
+ file = new File(filename);
+ if (file.exists()) {
+ file = dealWithExistingFile(file, JOptionPane.showConfirmDialog(this,
+ localizationResources.getString(
+ "FILE_EXISTS_CONFIRM_OVERWRITE"),
+ localizationResources.getString(saveAs),
+ JOptionPane.OK_CANCEL_OPTION));
+ }
+ }
+ return file;
+ }
+
+ File dealWithExistingFile(File file, int response) {
+ if (response == JOptionPane.CANCEL_OPTION) {
+ file = null;
+ }
+ return file;
+ }
+
+ JFileChooser createFileChooser(String description, String extension) {
+ JFileChooser fileChooser = new JFileChooser();
+ fileChooser.setCurrentDirectory(this.defaultDirectoryForSaveAs);
+ FileNameExtensionFilter filter = new FileNameExtensionFilter(
+ localizationResources.getString(description), extension);
+ fileChooser.addChoosableFileFilter(filter);
+ fileChooser.setFileFilter(filter);
+ return fileChooser;
+ }
+
/**
* Generates a string containing a rendering of the chart in SVG format.
* This feature is only supported if the JFreeSVG library is included on
@@ -2775,7 +2811,7 @@
* {@code null} if there is a problem with the method invocation
* by reflection.
*/
- private String generateSVG(int width, int height) {
+ String generateSVG(int width, int height) {
Graphics2D g2 = createSVGGraphics2D(width, height);
if (g2 == null) {
throw new IllegalStateException("JFreeSVG library is not present.");
@@ -2834,34 +2870,10 @@
private void saveAsPDF(File f) {
File file = f;
if (file == null) {
- JFileChooser fileChooser = new JFileChooser();
- fileChooser.setCurrentDirectory(this.defaultDirectoryForSaveAs);
- FileNameExtensionFilter filter = new FileNameExtensionFilter(
- localizationResources.getString("PDF_Files"), "pdf");
- fileChooser.addChoosableFileFilter(filter);
- fileChooser.setFileFilter(filter);
+ JFileChooser fileChooser = createFileChooser("PDF_Files", "pdf");
int option = fileChooser.showSaveDialog(this);
- if (option == JFileChooser.APPROVE_OPTION) {
- String filename = fileChooser.getSelectedFile().getPath();
- if (isEnforceFileExtensions()) {
- if (!filename.endsWith(".pdf")) {
- filename = filename + ".pdf";
- }
- }
- file = new File(filename);
- if (file.exists()) {
- String fileExists = localizationResources.getString(
- "FILE_EXISTS_CONFIRM_OVERWRITE");
- int response = JOptionPane.showConfirmDialog(this,
- fileExists,
- localizationResources.getString("Save_as_PDF"),
- JOptionPane.OK_CANCEL_OPTION);
- if (response == JOptionPane.CANCEL_OPTION) {
- file = null;
- }
- }
- }
+ file = saveFile(option, fileChooser, ".pdf", file, "Save_as_PDF");
}
if (file != null) {
@@ -3320,4 +3332,24 @@
}
+ public boolean isOwnToolTipDelaysActive() {
+ return ownToolTipDelaysActive;
+ }
+
+ public Point getPanLast() {
+ return panLast;
+ }
+
+ public void setPanLast(Point panLast) {
+ this.panLast = panLast;
+ }
+
+ public Point2D getZoomPoint() {
+ return zoomPoint;
+ }
+
+ public Rectangle2D getZoomRectangle() {
+ return zoomRectangle;
+ }
+
}
diff -burN jfreechart-original/src/main/java/org/jfree/chart/plot/CategoryPlot.java jfreechart-after-maintenance/src/main/java/org/jfree/chart/plot/CategoryPlot.java
--- jfreechart-original/src/main/java/org/jfree/chart/plot/CategoryPlot.java 2022-03-07 09:23:25.000000000 +0100
+++ jfreechart-after-maintenance/src/main/java/org/jfree/chart/plot/CategoryPlot.java 2022-04-17 18:12:48.000000000 +0200
@@ -219,6 +219,7 @@
import java.util.TreeMap;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.LegendItemCollection;
+import org.jfree.chart.LegendItemSource;
import org.jfree.chart.annotations.Annotation;
import org.jfree.chart.annotations.CategoryAnnotation;
import org.jfree.chart.axis.Axis;
@@ -233,11 +234,9 @@
import org.jfree.chart.axis.ValueTick;
import org.jfree.chart.event.AnnotationChangeEvent;
import org.jfree.chart.event.AnnotationChangeListener;
-import org.jfree.chart.event.ChartChangeEventType;
import org.jfree.chart.event.PlotChangeEvent;
import org.jfree.chart.event.RendererChangeEvent;
import org.jfree.chart.event.RendererChangeListener;
-import org.jfree.chart.renderer.category.AbstractCategoryItemRenderer;
import org.jfree.chart.renderer.category.CategoryItemRenderer;
import org.jfree.chart.renderer.category.CategoryItemRendererState;
import org.jfree.chart.ui.Layer;
@@ -262,7 +261,7 @@
* A general plotting class that uses data from a {@link CategoryDataset} and
* renders each data item using a {@link CategoryItemRenderer}.
*/
-public class CategoryPlot extends Plot implements ValueAxisPlot, Pannable,
+public class CategoryPlot extends CategoryXYCommon implements ValueAxisPlot, Pannable,
Zoomable, AnnotationChangeListener, RendererChangeListener,
Cloneable, PublicCloneable, Serializable {
@@ -320,29 +319,15 @@
= ResourceBundleWrapper.getBundle(
"org.jfree.chart.plot.LocalizationBundle");
- /** The plot orientation. */
- private PlotOrientation orientation;
-
- /** The offset between the data area and the axes. */
- private RectangleInsets axisOffset;
-
/** Storage for the domain axes. */
private Map
- * If the flag value is changed, a {@link PlotChangeEvent} is sent to all
- * registered listeners.
- *
- * @param visible the new value of the flag.
- *
- * @see #isRangeMinorGridlinesVisible()
- *
- * @since 1.0.13
- */
- public void setRangeMinorGridlinesVisible(boolean visible) {
- if (this.rangeMinorGridlinesVisible != visible) {
- this.rangeMinorGridlinesVisible = visible;
- fireChangeEvent();
- }
- }
-
- /**
- * Returns the stroke for the minor grid lines (if any) plotted against the
- * range axis.
- *
- * @return The stroke (never {@code null}).
- *
- * @see #setRangeMinorGridlineStroke(Stroke)
- *
- * @since 1.0.13
- */
- public Stroke getRangeMinorGridlineStroke() {
- return this.rangeMinorGridlineStroke;
- }
-
- /**
- * Sets the stroke for the minor grid lines plotted against the range axis,
- * and sends a {@link PlotChangeEvent} to all registered listeners.
- *
- * @param stroke the stroke ({@code null} not permitted).
- *
- * @see #getRangeMinorGridlineStroke()
- *
- * @since 1.0.13
- */
- public void setRangeMinorGridlineStroke(Stroke stroke) {
- Args.nullNotPermitted(stroke, "stroke");
- this.rangeMinorGridlineStroke = stroke;
- fireChangeEvent();
- }
-
- /**
- * Returns the paint for the minor grid lines (if any) plotted against the
- * range axis.
- *
- * @return The paint (never {@code null}).
- *
- * @see #setRangeMinorGridlinePaint(Paint)
- *
- * @since 1.0.13
- */
- public Paint getRangeMinorGridlinePaint() {
- return this.rangeMinorGridlinePaint;
- }
-
- /**
- * Sets the paint for the minor grid lines plotted against the range axis
- * and sends a {@link PlotChangeEvent} to all registered listeners.
- *
- * @param paint the paint ({@code null} not permitted).
- *
- * @see #getRangeMinorGridlinePaint()
- *
- * @since 1.0.13
- */
- public void setRangeMinorGridlinePaint(Paint paint) {
- Args.nullNotPermitted(paint, "paint");
- this.rangeMinorGridlinePaint = paint;
- fireChangeEvent();
- }
-
- /**
* Returns the fixed legend items, if any.
*
* @return The legend items (possibly {@code null}).
@@ -2273,18 +1784,8 @@
*/
@Override
public void datasetChanged(DatasetChangeEvent event) {
- for (ValueAxis yAxis : this.rangeAxes.values()) {
- if (yAxis != null) {
- yAxis.configure();
- }
- }
- if (getParent() != null) {
- getParent().datasetChanged(event);
- } else {
- PlotChangeEvent e = new PlotChangeEvent(this);
- e.setType(ChartChangeEventType.DATASET_UPDATED);
- notifyListeners(e);
- }
+ configureRangeAxes();
+ dealWithEventWhenDatasetChanges(event);
}
@@ -2361,261 +1862,6 @@
}
/**
- * Adds a marker for display by a particular renderer and, if requested,
- * sends a {@link PlotChangeEvent} to all registered listeners.
- *
- * Typically a marker will be drawn by the renderer as a line perpendicular
- * to a domain axis, however this is entirely up to the renderer.
- *
- * @param index the renderer index.
- * @param marker the marker ({@code null} not permitted).
- * @param layer the layer ({@code null} not permitted).
- * @param notify notify listeners?
- *
- * @since 1.0.10
- *
- * @see #removeDomainMarker(int, Marker, Layer, boolean)
- */
- public void addDomainMarker(int index, CategoryMarker marker, Layer layer,
- boolean notify) {
- Args.nullNotPermitted(marker, "marker");
- Args.nullNotPermitted(layer, "layer");
- Collection markers;
- if (layer == Layer.FOREGROUND) {
- markers = (Collection) this.foregroundDomainMarkers.get(
- new Integer(index));
- if (markers == null) {
- markers = new java.util.ArrayList();
- this.foregroundDomainMarkers.put(new Integer(index), markers);
- }
- markers.add(marker);
- } else if (layer == Layer.BACKGROUND) {
- markers = (Collection) this.backgroundDomainMarkers.get(
- new Integer(index));
- if (markers == null) {
- markers = new java.util.ArrayList();
- this.backgroundDomainMarkers.put(new Integer(index), markers);
- }
- markers.add(marker);
- }
- marker.addChangeListener(this);
- if (notify) {
- fireChangeEvent();
- }
- }
-
- /**
- * Clears all the domain markers for the plot and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @see #clearRangeMarkers()
- */
- public void clearDomainMarkers() {
- if (this.backgroundDomainMarkers != null) {
- Set keys = this.backgroundDomainMarkers.keySet();
- Iterator iterator = keys.iterator();
- while (iterator.hasNext()) {
- Integer key = (Integer) iterator.next();
- clearDomainMarkers(key.intValue());
- }
- this.backgroundDomainMarkers.clear();
- }
- if (this.foregroundDomainMarkers != null) {
- Set keys = this.foregroundDomainMarkers.keySet();
- Iterator iterator = keys.iterator();
- while (iterator.hasNext()) {
- Integer key = (Integer) iterator.next();
- clearDomainMarkers(key.intValue());
- }
- this.foregroundDomainMarkers.clear();
- }
- fireChangeEvent();
- }
-
- /**
- * Returns the list of domain markers (read only) for the specified layer.
- *
- * @param layer the layer (foreground or background).
- *
- * @return The list of domain markers.
- */
- public Collection getDomainMarkers(Layer layer) {
- return getDomainMarkers(0, layer);
- }
-
- /**
- * Returns a collection of domain markers for a particular renderer and
- * layer.
- *
- * @param index the renderer index.
- * @param layer the layer.
- *
- * @return A collection of markers (possibly {@code null}).
- */
- public Collection getDomainMarkers(int index, Layer layer) {
- Collection result = null;
- Integer key = new Integer(index);
- if (layer == Layer.FOREGROUND) {
- result = (Collection) this.foregroundDomainMarkers.get(key);
- }
- else if (layer == Layer.BACKGROUND) {
- result = (Collection) this.backgroundDomainMarkers.get(key);
- }
- if (result != null) {
- result = Collections.unmodifiableCollection(result);
- }
- return result;
- }
-
- /**
- * Clears all the domain markers for the specified renderer.
- *
- * @param index the renderer index.
- *
- * @see #clearRangeMarkers(int)
- */
- public void clearDomainMarkers(int index) {
- Integer key = new Integer(index);
- if (this.backgroundDomainMarkers != null) {
- Collection markers
- = (Collection) this.backgroundDomainMarkers.get(key);
- if (markers != null) {
- Iterator iterator = markers.iterator();
- while (iterator.hasNext()) {
- Marker m = (Marker) iterator.next();
- m.removeChangeListener(this);
- }
- markers.clear();
- }
- }
- if (this.foregroundDomainMarkers != null) {
- Collection markers
- = (Collection) this.foregroundDomainMarkers.get(key);
- if (markers != null) {
- Iterator iterator = markers.iterator();
- while (iterator.hasNext()) {
- Marker m = (Marker) iterator.next();
- m.removeChangeListener(this);
- }
- markers.clear();
- }
- }
- fireChangeEvent();
- }
-
- /**
- * Removes a marker for the domain axis and sends a {@link PlotChangeEvent}
- * to all registered listeners.
- *
- * @param marker the marker.
- *
- * @return A boolean indicating whether or not the marker was actually
- * removed.
- *
- * @since 1.0.7
- */
- public boolean removeDomainMarker(Marker marker) {
- return removeDomainMarker(marker, Layer.FOREGROUND);
- }
-
- /**
- * Removes a marker for the domain axis in the specified layer and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param marker the marker ({@code null} not permitted).
- * @param layer the layer (foreground or background).
- *
- * @return A boolean indicating whether or not the marker was actually
- * removed.
- *
- * @since 1.0.7
- */
- public boolean removeDomainMarker(Marker marker, Layer layer) {
- return removeDomainMarker(0, marker, layer);
- }
-
- /**
- * Removes a marker for a specific dataset/renderer and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param index the dataset/renderer index.
- * @param marker the marker.
- * @param layer the layer (foreground or background).
- *
- * @return A boolean indicating whether or not the marker was actually
- * removed.
- *
- * @since 1.0.7
- */
- public boolean removeDomainMarker(int index, Marker marker, Layer layer) {
- return removeDomainMarker(index, marker, layer, true);
- }
-
- /**
- * Removes a marker for a specific dataset/renderer and, if requested,
- * sends a {@link PlotChangeEvent} to all registered listeners.
- *
- * @param index the dataset/renderer index.
- * @param marker the marker.
- * @param layer the layer (foreground or background).
- * @param notify notify listeners?
- *
- * @return A boolean indicating whether or not the marker was actually
- * removed.
- *
- * @since 1.0.10
- */
- public boolean removeDomainMarker(int index, Marker marker, Layer layer,
- boolean notify) {
- ArrayList markers;
- if (layer == Layer.FOREGROUND) {
- markers = (ArrayList) this.foregroundDomainMarkers.get(new Integer(
- index));
- } else {
- markers = (ArrayList) this.backgroundDomainMarkers.get(new Integer(
- index));
- }
- if (markers == null) {
- return false;
- }
- boolean removed = markers.remove(marker);
- if (removed && notify) {
- fireChangeEvent();
- }
- return removed;
- }
-
- /**
- * Adds a marker for display (in the foreground) against the range axis and
- * sends a {@link PlotChangeEvent} to all registered listeners. Typically a
- * marker will be drawn by the renderer as a line perpendicular to the
- * range axis, however this is entirely up to the renderer.
- *
- * @param marker the marker ({@code null} not permitted).
- *
- * @see #removeRangeMarker(Marker)
- */
- public void addRangeMarker(Marker marker) {
- addRangeMarker(marker, Layer.FOREGROUND);
- }
-
- /**
- * Adds a marker for display against the range axis and sends a
- * {@link PlotChangeEvent} to all registered listeners. Typically a marker
- * will be drawn by the renderer as a line perpendicular to the range axis,
- * however this is entirely up to the renderer.
- *
- * @param marker the marker ({@code null} not permitted).
- * @param layer the layer (foreground or background) ({@code null}
- * not permitted).
- *
- * @see #removeRangeMarker(Marker, Layer)
- */
- public void addRangeMarker(Marker marker, Layer layer) {
- addRangeMarker(0, marker, layer);
- }
-
- /**
* Adds a marker for display by a particular renderer and sends a
* {@link PlotChangeEvent} to all registered listeners.
*
@@ -2675,34 +1921,6 @@
}
/**
- * Clears all the range markers for the plot and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @see #clearDomainMarkers()
- */
- public void clearRangeMarkers() {
- if (this.backgroundRangeMarkers != null) {
- Set keys = this.backgroundRangeMarkers.keySet();
- Iterator iterator = keys.iterator();
- while (iterator.hasNext()) {
- Integer key = (Integer) iterator.next();
- clearRangeMarkers(key.intValue());
- }
- this.backgroundRangeMarkers.clear();
- }
- if (this.foregroundRangeMarkers != null) {
- Set keys = this.foregroundRangeMarkers.keySet();
- Iterator iterator = keys.iterator();
- while (iterator.hasNext()) {
- Integer key = (Integer) iterator.next();
- clearRangeMarkers(key.intValue());
- }
- this.foregroundRangeMarkers.clear();
- }
- fireChangeEvent();
- }
-
- /**
* Returns the list of range markers (read only) for the specified layer.
*
* @param layer the layer (foreground or background).
@@ -2740,96 +1958,6 @@
}
/**
- * Clears all the range markers for the specified renderer.
- *
- * @param index the renderer index.
- *
- * @see #clearDomainMarkers(int)
- */
- public void clearRangeMarkers(int index) {
- Integer key = new Integer(index);
- if (this.backgroundRangeMarkers != null) {
- Collection markers
- = (Collection) this.backgroundRangeMarkers.get(key);
- if (markers != null) {
- Iterator iterator = markers.iterator();
- while (iterator.hasNext()) {
- Marker m = (Marker) iterator.next();
- m.removeChangeListener(this);
- }
- markers.clear();
- }
- }
- if (this.foregroundRangeMarkers != null) {
- Collection markers
- = (Collection) this.foregroundRangeMarkers.get(key);
- if (markers != null) {
- Iterator iterator = markers.iterator();
- while (iterator.hasNext()) {
- Marker m = (Marker) iterator.next();
- m.removeChangeListener(this);
- }
- markers.clear();
- }
- }
- fireChangeEvent();
- }
-
- /**
- * Removes a marker for the range axis and sends a {@link PlotChangeEvent}
- * to all registered listeners.
- *
- * @param marker the marker.
- *
- * @return A boolean indicating whether or not the marker was actually
- * removed.
- *
- * @since 1.0.7
- *
- * @see #addRangeMarker(Marker)
- */
- public boolean removeRangeMarker(Marker marker) {
- return removeRangeMarker(marker, Layer.FOREGROUND);
- }
-
- /**
- * Removes a marker for the range axis in the specified layer and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param marker the marker ({@code null} not permitted).
- * @param layer the layer (foreground or background).
- *
- * @return A boolean indicating whether or not the marker was actually
- * removed.
- *
- * @since 1.0.7
- *
- * @see #addRangeMarker(Marker, Layer)
- */
- public boolean removeRangeMarker(Marker marker, Layer layer) {
- return removeRangeMarker(0, marker, layer);
- }
-
- /**
- * Removes a marker for a specific dataset/renderer and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param index the dataset/renderer index.
- * @param marker the marker.
- * @param layer the layer (foreground or background).
- *
- * @return A boolean indicating whether or not the marker was actually
- * removed.
- *
- * @since 1.0.7
- *
- * @see #addRangeMarker(int, Marker, Layer)
- */
- public boolean removeRangeMarker(int index, Marker marker, Layer layer) {
- return removeRangeMarker(index, marker, layer, true);
- }
-
- /**
* Removes a marker for a specific dataset/renderer and sends a
* {@link PlotChangeEvent} to all registered listeners.
*
@@ -3425,13 +2553,7 @@
}
} else {
// reserve space for the range axes (if any)...
- for (ValueAxis yAxis : this.rangeAxes.values()) {
- if (yAxis != null) {
- int i = findRangeAxisIndex(yAxis);
- RectangleEdge edge = getRangeAxisEdge(i);
- space = yAxis.reserveSpace(g2, this, plotArea, edge, space);
- }
- }
+ space = reserveSpaceForTheRangeAxes(g2, plotArea, space);
}
return space;
@@ -3511,7 +2633,7 @@
// calculate the data area...
AxisSpace space = calculateAxisSpace(g2, area);
Rectangle2D dataArea = space.shrink(area, null);
- this.axisOffset.trim(dataArea);
+ trimAxisOffset(dataArea);
dataArea = integerise(dataArea);
if (dataArea.isEmpty()) {
return;
@@ -3769,7 +2891,7 @@
*
* @return A map containing the axis states.
*/
- protected Map drawAxes(Graphics2D g2, Rectangle2D plotArea,
+ protected Map
+ * If the flag value is changed, a {@link PlotChangeEvent} is sent to all
+ * registered listeners.
+ *
+ * @param visible the new value of the flag.
+ *
+ * @see #isRangeMinorGridlinesVisible()
+ *
+ * @since 1.0.13
+ */
+ public void setRangeMinorGridlinesVisible(boolean visible) {
+ if (this.rangeMinorGridlinesVisible != visible) {
+ this.rangeMinorGridlinesVisible = visible;
+ fireChangeEvent();
+ }
+ }
+
+ /**
+ * Returns the stroke for the minor grid lines (if any) plotted against the
+ * range axis.
+ *
+ * @return The stroke (never {@code null}).
+ *
+ * @see #setRangeMinorGridlineStroke(Stroke)
+ *
+ * @since 1.0.13
+ */
+ public Stroke getRangeMinorGridlineStroke() {
+ return this.rangeMinorGridlineStroke;
+ }
+
+ /**
+ * Sets the stroke for the minor grid lines plotted against the range axis,
+ * and sends a {@link PlotChangeEvent} to all registered listeners.
+ *
+ * @param stroke the stroke ({@code null} not permitted).
+ *
+ * @see #getRangeMinorGridlineStroke()
+ *
+ * @since 1.0.13
+ */
+ public void setRangeMinorGridlineStroke(Stroke stroke) {
+ Args.nullNotPermitted(stroke, "stroke");
+ this.rangeMinorGridlineStroke = stroke;
+ fireChangeEvent();
+ }
+
+ /**
+ * Returns the paint for the minor grid lines (if any) plotted against the
+ * range axis.
+ *
+ * @return The paint (never {@code null}).
+ *
+ * @see #setRangeMinorGridlinePaint(Paint)
+ *
+ * @since 1.0.13
+ */
+ public Paint getRangeMinorGridlinePaint() {
+ return this.rangeMinorGridlinePaint;
+ }
+
+ /**
+ * Sets the paint for the minor grid lines plotted against the range axis
+ * and sends a {@link PlotChangeEvent} to all registered listeners.
+ *
+ * @param paint the paint ({@code null} not permitted).
+ *
+ * @see #getRangeMinorGridlinePaint()
+ *
+ * @since 1.0.13
+ */
+ public void setRangeMinorGridlinePaint(Paint paint) {
+ Args.nullNotPermitted(paint, "paint");
+ this.rangeMinorGridlinePaint = paint;
+ fireChangeEvent();
+ }
+
+
+ /**
+ * Clears all the domain markers for the plot and sends a
+ * {@link PlotChangeEvent} to all registered listeners.
+ *
+ * @see #clearRangeMarkers()
+ */
+ public void clearDomainMarkers() {
+ if (this.backgroundDomainMarkers != null) {
+ Set keys = this.backgroundDomainMarkers.keySet();
+ Iterator iterator = keys.iterator();
+ while (iterator.hasNext()) {
+ Integer key = (Integer) iterator.next();
+ clearDomainMarkers(key.intValue());
+ }
+ this.backgroundDomainMarkers.clear();
+ }
+ if (this.foregroundDomainMarkers != null) {
+ Set keys = this.foregroundDomainMarkers.keySet();
+ Iterator iterator = keys.iterator();
+ while (iterator.hasNext()) {
+ Integer key = (Integer) iterator.next();
+ clearDomainMarkers(key.intValue());
+ }
+ this.foregroundDomainMarkers.clear();
+ }
+ fireChangeEvent();
+ }
+ /**
+ * Clears all the domain markers for the specified renderer.
+ *
+ * @param index the renderer index.
+ *
+ * @see #clearRangeMarkers(int)
+ */
+ public void clearDomainMarkers(int index) {
+ Integer key = new Integer(index);
+ if (this.backgroundDomainMarkers != null) {
+ Collection markers
+ = (Collection) this.backgroundDomainMarkers.get(key);
+ if (markers != null) {
+ Iterator iterator = markers.iterator();
+ while (iterator.hasNext()) {
+ Marker m = (Marker) iterator.next();
+ m.removeChangeListener(this);
+ }
+ markers.clear();
+ }
+ }
+ if (this.foregroundDomainMarkers != null) {
+ Collection markers
+ = (Collection) this.foregroundDomainMarkers.get(key);
+ if (markers != null) {
+ Iterator iterator = markers.iterator();
+ while (iterator.hasNext()) {
+ Marker m = (Marker) iterator.next();
+ m.removeChangeListener(this);
+ }
+ markers.clear();
+ }
+ }
+ fireChangeEvent();
+ }
+
+ /**
+ * Adds a marker for display by a particular renderer and, if requested,
+ * sends a {@link PlotChangeEvent} to all registered listeners.
+ *
+ * Typically a marker will be drawn by the renderer as a line perpendicular
+ * to a domain axis, however this is entirely up to the renderer.
+ *
+ * @param index the renderer index.
+ * @param marker the marker ({@code null} not permitted).
+ * @param layer the layer ({@code null} not permitted).
+ * @param notify notify listeners?
+ *
+ * @since 1.0.10
+ *
+ * @see #removeDomainMarker(int, Marker, Layer, boolean)
+ */
+ public void addDomainMarker(int index, CategoryMarker marker, Layer layer,
+ boolean notify) {
+ Args.nullNotPermitted(marker, "marker");
+ Args.nullNotPermitted(layer, "layer");
+ Collection markers;
+ if (layer == Layer.FOREGROUND) {
+ markers = (Collection) this.foregroundDomainMarkers.get(
+ new Integer(index));
+ if (markers == null) {
+ markers = new java.util.ArrayList();
+ this.foregroundDomainMarkers.put(new Integer(index), markers);
+ }
+ markers.add(marker);
+ } else if (layer == Layer.BACKGROUND) {
+ markers = (Collection) this.backgroundDomainMarkers.get(
+ new Integer(index));
+ if (markers == null) {
+ markers = new java.util.ArrayList();
+ this.backgroundDomainMarkers.put(new Integer(index), markers);
+ }
+ markers.add(marker);
+ }
+ marker.addChangeListener(this);
+ if (notify) {
+ fireChangeEvent();
+ }
+ }
+
+
+ /**
+ * Returns the list of domain markers (read only) for the specified layer.
+ *
+ * @param layer the layer (foreground or background).
+ *
+ * @return The list of domain markers.
+ */
+ public Collection getDomainMarkers(Layer layer) {
+ return getDomainMarkers(0, layer);
+ }
+
+ /**
+ * Returns a collection of domain markers for a particular renderer and
+ * layer.
+ *
+ * @param index the renderer index.
+ * @param layer the layer.
+ *
+ * @return A collection of markers (possibly {@code null}).
+ */
+ public Collection getDomainMarkers(int index, Layer layer) {
+ Collection result = null;
+ Integer key = new Integer(index);
+ if (layer == Layer.FOREGROUND) {
+ result = (Collection) this.foregroundDomainMarkers.get(key);
+ }
+ else if (layer == Layer.BACKGROUND) {
+ result = (Collection) this.backgroundDomainMarkers.get(key);
+ }
+ if (result != null) {
+ result = Collections.unmodifiableCollection(result);
+ }
+ return result;
+ }
+
+ /**
+ * Removes a marker for the domain axis and sends a {@link PlotChangeEvent}
+ * to all registered listeners.
+ *
+ * @param marker the marker.
+ *
+ * @return A boolean indicating whether or not the marker was actually
+ * removed.
+ *
+ * @since 1.0.7
+ */
+ public boolean removeDomainMarker(Marker marker) {
+ return removeDomainMarker(marker, Layer.FOREGROUND);
+ }
+
+ /**
+ * Removes a marker for the domain axis in the specified layer and sends a
+ * {@link PlotChangeEvent} to all registered listeners.
+ *
+ * @param marker the marker ({@code null} not permitted).
+ * @param layer the layer (foreground or background).
+ *
+ * @return A boolean indicating whether or not the marker was actually
+ * removed.
+ *
+ * @since 1.0.7
+ */
+ public boolean removeDomainMarker(Marker marker, Layer layer) {
+ return removeDomainMarker(0, marker, layer);
+ }
+
+ /**
+ * Removes a marker for a specific dataset/renderer and sends a
+ * {@link PlotChangeEvent} to all registered listeners.
+ *
+ * @param index the dataset/renderer index.
+ * @param marker the marker.
+ * @param layer the layer (foreground or background).
+ *
+ * @return A boolean indicating whether or not the marker was actually
+ * removed.
+ *
+ * @since 1.0.7
+ */
+ public boolean removeDomainMarker(int index, Marker marker, Layer layer) {
+ return removeDomainMarker(index, marker, layer, true);
+ }
+
+ /**
+ * Removes a marker for a specific dataset/renderer and, if requested,
+ * sends a {@link PlotChangeEvent} to all registered listeners.
+ *
+ * @param index the dataset/renderer index.
+ * @param marker the marker.
+ * @param layer the layer (foreground or background).
+ * @param notify notify listeners?
+ *
+ * @return A boolean indicating whether or not the marker was actually
+ * removed.
+ *
+ * @since 1.0.10
+ */
+ public boolean removeDomainMarker(int index, Marker marker, Layer layer,
+ boolean notify) {
+ ArrayList markers;
+ if (layer == Layer.FOREGROUND) {
+ markers = (ArrayList) this.foregroundDomainMarkers.get(new Integer(
+ index));
+ } else {
+ markers = (ArrayList) this.backgroundDomainMarkers.get(new Integer(
+ index));
+ }
+ if (markers == null) {
+ return false;
+ }
+ boolean removed = markers.remove(marker);
+ if (removed && notify) {
+ fireChangeEvent();
+ }
+ return removed;
+ }
+
+ /**
+ * Adds a marker for display (in the foreground) against the range axis and
+ * sends a {@link PlotChangeEvent} to all registered listeners. Typically a
+ * marker will be drawn by the renderer as a line perpendicular to the
+ * range axis, however this is entirely up to the renderer.
+ *
+ * @param marker the marker ({@code null} not permitted).
+ *
+ * @see #removeRangeMarker(Marker)
+ */
+ public void addRangeMarker(Marker marker) {
+ addRangeMarker(marker, Layer.FOREGROUND);
+ }
+
+ /**
+ * Adds a marker for display against the range axis and sends a
+ * {@link PlotChangeEvent} to all registered listeners. Typically a marker
+ * will be drawn by the renderer as a line perpendicular to the range axis,
+ * however this is entirely up to the renderer.
+ *
+ * @param marker the marker ({@code null} not permitted).
+ * @param layer the layer (foreground or background) ({@code null}
+ * not permitted).
+ *
+ * @see #removeRangeMarker(Marker, Layer)
+ */
+ public void addRangeMarker(Marker marker, Layer layer) {
+ addRangeMarker(0, marker, layer);
+ }
+
+ /**
+ * Adds a marker for a specific dataset/renderer and sends a
+ * {@link PlotChangeEvent} to all registered listeners.
+ *
+ * Typically a marker will be drawn by the renderer as a line perpendicular
+ * to the range axis, however this is entirely up to the renderer.
+ *
+ * @param index the dataset/renderer index.
+ * @param marker the marker.
+ * @param layer the layer (foreground or background).
+ *
+ * @see #clearRangeMarkers(int)
+ * @see #addDomainMarker(int, Marker, Layer)
+ */
+ public void addRangeMarker(int index, Marker marker, Layer layer) {
+ addRangeMarker(index, marker, layer, true);
+ }
+
+ protected abstract void addRangeMarker(int index, Marker marker, Layer layer, boolean notify);
+
+ /**
+ * Clears all the range markers and sends a {@link PlotChangeEvent} to all
+ * registered listeners.
+ *
+ * @see #clearRangeMarkers()
+ */
+ public void clearRangeMarkers() {
+ if (this.backgroundRangeMarkers != null) {
+ Set
- * If the flag value is changed, a {@link PlotChangeEvent} is sent to all
- * registered listeners.
- *
- * @param visible the new value of the flag.
- *
- * @see #isRangeGridlinesVisible()
- */
- public void setRangeGridlinesVisible(boolean visible) {
- if (this.rangeGridlinesVisible != visible) {
- this.rangeGridlinesVisible = visible;
- fireChangeEvent();
- }
- }
-
- /**
- * Returns the stroke for the grid lines (if any) plotted against the
- * range axis.
- *
- * @return The stroke (never {@code null}).
- *
- * @see #setRangeGridlineStroke(Stroke)
- */
- public Stroke getRangeGridlineStroke() {
- return this.rangeGridlineStroke;
- }
-
- /**
- * Sets the stroke for the grid lines plotted against the range axis,
- * and sends a {@link PlotChangeEvent} to all registered listeners.
- *
- * @param stroke the stroke ({@code null} not permitted).
- *
- * @see #getRangeGridlineStroke()
- */
- public void setRangeGridlineStroke(Stroke stroke) {
- Args.nullNotPermitted(stroke, "stroke");
- this.rangeGridlineStroke = stroke;
- fireChangeEvent();
- }
-
- /**
- * Returns the paint for the grid lines (if any) plotted against the range
- * axis.
- *
- * @return The paint (never {@code null}).
- *
- * @see #setRangeGridlinePaint(Paint)
- */
- public Paint getRangeGridlinePaint() {
- return this.rangeGridlinePaint;
- }
-
- /**
- * Sets the paint for the grid lines plotted against the range axis and
- * sends a {@link PlotChangeEvent} to all registered listeners.
- *
- * @param paint the paint ({@code null} not permitted).
- *
- * @see #getRangeGridlinePaint()
- */
- public void setRangeGridlinePaint(Paint paint) {
- Args.nullNotPermitted(paint, "paint");
- this.rangeGridlinePaint = paint;
- fireChangeEvent();
- }
-
- /**
- * Returns {@code true} if the range axis minor grid is visible, and
- * {@code false} otherwise.
- *
- * @return A boolean.
- *
- * @see #setRangeMinorGridlinesVisible(boolean)
- *
- * @since 1.0.12
- */
- public boolean isRangeMinorGridlinesVisible() {
- return this.rangeMinorGridlinesVisible;
- }
-
- /**
- * Sets the flag that controls whether or not the range axis minor grid
- * lines are visible.
- *
- * If the flag value is changed, a {@link PlotChangeEvent} is sent to all
- * registered listeners.
- *
- * @param visible the new value of the flag.
- *
- * @see #isRangeMinorGridlinesVisible()
- *
- * @since 1.0.12
- */
- public void setRangeMinorGridlinesVisible(boolean visible) {
- if (this.rangeMinorGridlinesVisible != visible) {
- this.rangeMinorGridlinesVisible = visible;
- fireChangeEvent();
- }
- }
-
- /**
- * Returns the stroke for the minor grid lines (if any) plotted against the
- * range axis.
- *
- * @return The stroke (never {@code null}).
- *
- * @see #setRangeMinorGridlineStroke(Stroke)
- *
- * @since 1.0.12
- */
- public Stroke getRangeMinorGridlineStroke() {
- return this.rangeMinorGridlineStroke;
- }
-
- /**
- * Sets the stroke for the minor grid lines plotted against the range axis,
- * and sends a {@link PlotChangeEvent} to all registered listeners.
- *
- * @param stroke the stroke ({@code null} not permitted).
- *
- * @see #getRangeMinorGridlineStroke()
- *
- * @since 1.0.12
- */
- public void setRangeMinorGridlineStroke(Stroke stroke) {
- Args.nullNotPermitted(stroke, "stroke");
- this.rangeMinorGridlineStroke = stroke;
- fireChangeEvent();
- }
-
- /**
- * Returns the paint for the minor grid lines (if any) plotted against the
- * range axis.
- *
- * @return The paint (never {@code null}).
- *
- * @see #setRangeMinorGridlinePaint(Paint)
- *
- * @since 1.0.12
- */
- public Paint getRangeMinorGridlinePaint() {
- return this.rangeMinorGridlinePaint;
- }
-
- /**
- * Sets the paint for the minor grid lines plotted against the range axis
- * and sends a {@link PlotChangeEvent} to all registered listeners.
- *
- * @param paint the paint ({@code null} not permitted).
- *
- * @see #getRangeMinorGridlinePaint()
- *
- * @since 1.0.12
- */
- public void setRangeMinorGridlinePaint(Paint paint) {
- Args.nullNotPermitted(paint, "paint");
- this.rangeMinorGridlinePaint = paint;
- fireChangeEvent();
- }
-
/**
* Returns a flag that controls whether or not a zero baseline is
* displayed for the domain axis.
@@ -2654,48 +2198,6 @@
}
/**
- * Clears all the range markers and sends a {@link PlotChangeEvent} to all
- * registered listeners.
- *
- * @see #clearRangeMarkers()
- */
- public void clearRangeMarkers() {
- if (this.backgroundRangeMarkers != null) {
- Set
- * Typically a marker will be drawn by the renderer as a line perpendicular
- * to the range axis, however this is entirely up to the renderer.
- *
- * @param index the dataset/renderer index.
- * @param marker the marker.
- * @param layer the layer (foreground or background).
- *
- * @see #clearRangeMarkers(int)
- * @see #addDomainMarker(int, Marker, Layer)
- */
- public void addRangeMarker(int index, Marker marker, Layer layer) {
- addRangeMarker(index, marker, layer, true);
- }
-
- /**
* Adds a marker for a specific dataset/renderer and, if requested, sends a
* {@link PlotChangeEvent} to all registered listeners.
*
@@ -2736,103 +2238,6 @@
}
}
- /**
- * Clears the (foreground and background) range markers for a particular
- * renderer.
- *
- * @param index the renderer index.
- */
- public void clearRangeMarkers(int index) {
- Integer key = new Integer(index);
- if (this.backgroundRangeMarkers != null) {
- Collection markers
- = (Collection) this.backgroundRangeMarkers.get(key);
- if (markers != null) {
- Iterator iterator = markers.iterator();
- while (iterator.hasNext()) {
- Marker m = (Marker) iterator.next();
- m.removeChangeListener(this);
- }
- markers.clear();
- }
- }
- if (this.foregroundRangeMarkers != null) {
- Collection markers
- = (Collection) this.foregroundRangeMarkers.get(key);
- if (markers != null) {
- Iterator iterator = markers.iterator();
- while (iterator.hasNext()) {
- Marker m = (Marker) iterator.next();
- m.removeChangeListener(this);
- }
- markers.clear();
- }
- }
- fireChangeEvent();
- }
-
- /**
- * Removes a marker for the range axis and sends a {@link PlotChangeEvent}
- * to all registered listeners.
- *
- * @param marker the marker.
- *
- * @return A boolean indicating whether or not the marker was actually
- * removed.
- *
- * @since 1.0.7
- */
- public boolean removeRangeMarker(Marker marker) {
- return removeRangeMarker(marker, Layer.FOREGROUND);
- }
-
- /**
- * Removes a marker for the range axis in the specified layer and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param marker the marker ({@code null} not permitted).
- * @param layer the layer (foreground or background).
- *
- * @return A boolean indicating whether or not the marker was actually
- * removed.
- *
- * @since 1.0.7
- */
- public boolean removeRangeMarker(Marker marker, Layer layer) {
- return removeRangeMarker(0, marker, layer);
- }
-
- /**
- * Removes a marker for a specific dataset/renderer and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param index the dataset/renderer index.
- * @param marker the marker ({@code null} not permitted).
- * @param layer the layer (foreground or background).
- *
- * @return A boolean indicating whether or not the marker was actually
- * removed.
- *
- * @since 1.0.7
- */
- public boolean removeRangeMarker(int index, Marker marker, Layer layer) {
- return removeRangeMarker(index, marker, layer, true);
- }
-
- /**
- * Removes a marker for a specific dataset/renderer and sends a
- * {@link PlotChangeEvent} to all registered listeners.
- *
- * @param index the dataset/renderer index.
- * @param marker the marker ({@code null} not permitted).
- * @param layer the layer (foreground or background) ({@code null} not permitted).
- * @param notify notify listeners?
- *
- * @return A boolean indicating whether or not the marker was actually
- * removed.
- *
- * @since 1.0.10
- */
public boolean removeRangeMarker(int index, Marker marker, Layer layer,
boolean notify) {
Args.nullNotPermitted(marker, "marker");
@@ -3070,13 +2475,7 @@
}
else {
// reserve space for the range axes...
- for (ValueAxis axis: this.rangeAxes.values()) {
- if (axis != null) {
- RectangleEdge edge = getRangeAxisEdge(
- findRangeAxisIndex(axis));
- space = axis.reserveSpace(g2, this, plotArea, edge, space);
- }
- }
+ space = reserveSpaceForTheRangeAxes(g2, plotArea, space);
}
return space;
@@ -3131,7 +2530,7 @@
AxisSpace space = calculateAxisSpace(g2, area);
Rectangle2D dataArea = space.shrink(area, null);
- this.axisOffset.trim(dataArea);
+ trimAxisOffset(dataArea);
dataArea = integerise(dataArea);
if (dataArea.isEmpty()) {
@@ -3614,65 +3013,8 @@
}
}
- // add range axes to lists...
- for (ValueAxis axis : this.rangeAxes.values()) {
- if (axis != null) {
- int axisIndex = findRangeAxisIndex(axis);
- axisCollection.add(axis, getRangeAxisEdge(axisIndex));
- }
- }
-
- Map axisStateMap = new HashMap();
-
- // draw the top axes
- double cursor = dataArea.getMinY() - this.axisOffset.calculateTopOutset(
- dataArea.getHeight());
- Iterator iterator = axisCollection.getAxesAtTop().iterator();
- while (iterator.hasNext()) {
- ValueAxis axis = (ValueAxis) iterator.next();
- AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
- RectangleEdge.TOP, plotState);
- cursor = info.getCursor();
- axisStateMap.put(axis, info);
- }
-
- // draw the bottom axes
- cursor = dataArea.getMaxY()
- + this.axisOffset.calculateBottomOutset(dataArea.getHeight());
- iterator = axisCollection.getAxesAtBottom().iterator();
- while (iterator.hasNext()) {
- ValueAxis axis = (ValueAxis) iterator.next();
- AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
- RectangleEdge.BOTTOM, plotState);
- cursor = info.getCursor();
- axisStateMap.put(axis, info);
- }
+ return extractedDraw(g2, plotArea, dataArea, plotState, axisCollection);
- // draw the left axes
- cursor = dataArea.getMinX()
- - this.axisOffset.calculateLeftOutset(dataArea.getWidth());
- iterator = axisCollection.getAxesAtLeft().iterator();
- while (iterator.hasNext()) {
- ValueAxis axis = (ValueAxis) iterator.next();
- AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
- RectangleEdge.LEFT, plotState);
- cursor = info.getCursor();
- axisStateMap.put(axis, info);
- }
-
- // draw the right axes
- cursor = dataArea.getMaxX()
- + this.axisOffset.calculateRightOutset(dataArea.getWidth());
- iterator = axisCollection.getAxesAtRight().iterator();
- while (iterator.hasNext()) {
- ValueAxis axis = (ValueAxis) iterator.next();
- AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
- RectangleEdge.RIGHT, plotState);
- cursor = info.getCursor();
- axisStateMap.put(axis, info);
- }
-
- return axisStateMap;
}
/**
@@ -4389,14 +3731,6 @@
return result;
}
- private int findRangeAxisIndex(ValueAxis axis) {
- for (Map.Entry