diff --git a/xchart/src/main/java/com/xeiam/xchart/StyleManager.java b/xchart/src/main/java/com/xeiam/xchart/StyleManager.java index 6c2d3f12d68c7eb35b49209fa9bfd2a052011e20..2673c0828ea7a6931c661d77a9ed8dbef70c7410 100644 --- a/xchart/src/main/java/com/xeiam/xchart/StyleManager.java +++ b/xchart/src/main/java/com/xeiam/xchart/StyleManager.java @@ -124,7 +124,6 @@ public class StyleManager { private TextAlignment xAxisLabelAlignment = TextAlignment.Centre; private TextAlignment yAxisLabelAlignment = TextAlignment.Left; private int xAxisLabelRotation = 0; - private int yAxisLabelRotation = 0; // Chart Plot Area /////////////////////////////// private boolean isPlotGridLinesVisible; @@ -918,16 +917,6 @@ public class StyleManager { this.xAxisLabelRotation = xAxisLabelRotation; } - public int getYAxisLabelRotation() { - - return yAxisLabelRotation; - } - - public void setYAxisLabelRotation(int yAxisLabelRotation) { - - this.yAxisLabelRotation = yAxisLabelRotation; - } - // Chart Plot Area /////////////////////////////// /** diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Axis.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Axis.java index 68de6dd23a66274bce8f1b6ff7029084933e5351..c65cc272bb9a0de2c162733e656269ef5e852af0 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Axis.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Axis.java @@ -158,23 +158,23 @@ public class Axis implements ChartPart { getChartPainter().getWidth() - - width // y-axis approx. width + - width // y-axis approx. width - - chartLegendWidth + - chartLegendWidth - - 2 - * getChartPainter().getStyleManager().getChartPadding() + - 2 + * getChartPainter().getStyleManager().getChartPadding() - - (getChartPainter().getStyleManager().isYAxisTicksVisible() ? (getChartPainter().getStyleManager().getPlotPadding()) : 0) + - (getChartPainter().getStyleManager().isYAxisTicksVisible() ? (getChartPainter().getStyleManager().getPlotPadding()) : 0) - - (getChartPainter().getStyleManager().getLegendPosition() == LegendPosition.OutsideE && getChartPainter().getStyleManager().isLegendVisible() ? getChartPainter().getStyleManager() - .getChartPadding() : 0) + - (getChartPainter().getStyleManager().getLegendPosition() == LegendPosition.OutsideE && getChartPainter().getStyleManager().isLegendVisible() ? getChartPainter().getStyleManager() + .getChartPadding() : 0) - ; + ; double height = getChartPainter().getHeight() - yOffset - axisPair.getXAxis().getXAxisHeightHint(approximateXAxisWidth) - getChartPainter().getStyleManager().getPlotPadding() - - getChartPainter().getStyleManager().getChartPadding(); + - getChartPainter().getStyleManager().getChartPadding(); Rectangle2D yAxisRectangle = new Rectangle2D.Double(xOffset, yOffset, width, height); this.paintZone = yAxisRectangle; // g.setColor(Color.green); @@ -201,7 +201,7 @@ public class Axis implements ChartPart { double xOffset = axisPair.getYAxis().getBounds().getWidth() + (getChartPainter().getStyleManager().isYAxisTicksVisible() ? getChartPainter().getStyleManager().getPlotPadding() : 0) - + getChartPainter().getStyleManager().getChartPadding(); + + getChartPainter().getStyleManager().getChartPadding(); double yOffset = axisPair.getYAxis().getBounds().getY() + axisPair.getYAxis().getBounds().getHeight() + getChartPainter().getStyleManager().getPlotPadding(); double chartLegendWidth = 0; @@ -213,19 +213,19 @@ public class Axis implements ChartPart { getChartPainter().getWidth() - - axisPair.getYAxis().getBounds().getWidth() // y-axis was already painted + - axisPair.getYAxis().getBounds().getWidth() // y-axis was already painted - - chartLegendWidth + - chartLegendWidth - - 2 - * getChartPainter().getStyleManager().getChartPadding() + - 2 + * getChartPainter().getStyleManager().getChartPadding() - - (getChartPainter().getStyleManager().isYAxisTicksVisible() ? (getChartPainter().getStyleManager().getPlotPadding()) : 0) + - (getChartPainter().getStyleManager().isYAxisTicksVisible() ? (getChartPainter().getStyleManager().getPlotPadding()) : 0) - - (getChartPainter().getStyleManager().getLegendPosition() == LegendPosition.OutsideE && getChartPainter().getStyleManager().isLegendVisible() ? getChartPainter().getStyleManager() - .getChartPadding() : 0) + - (getChartPainter().getStyleManager().getLegendPosition() == LegendPosition.OutsideE && getChartPainter().getStyleManager().isLegendVisible() ? getChartPainter().getStyleManager() + .getChartPadding() : 0) - ; + ; double height = this.getXAxisHeightHint(width); Rectangle2D xAxisRectangle = new Rectangle2D.Double(xOffset, yOffset, width, height); @@ -248,6 +248,9 @@ public class Axis implements ChartPart { } /** + * The vertical Y-Axis is drawn first, but to know the lower bounds of it, we need to know how high the X-Axis paint zone is going to be. Since the tick labels could be rotated, we need to actually + * determine the tick labels first to get an idea of how tall thew X-Axis tick labels will be. + * * @return */ private double getXAxisHeightHint(double workingSpace) { diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickLabels.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickLabels.java index cd59f6904f039558662e42aa7722e592193bf061..d22f8635f076cfd3a3477754ed26637e71f949ac 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickLabels.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickLabels.java @@ -89,9 +89,7 @@ public class AxisTickLabels implements ChartPart { for (Double tickLocation : axisLabelTextLayouts.keySet()) { TextLayout axisLabelTextLayout = axisLabelTextLayouts.get(tickLocation); - AffineTransform rot = - getChartPainter().getStyleManager().getYAxisLabelRotation() == 0 ? null : AffineTransform.getRotateInstance(-Math.toRadians(getChartPainter().getStyleManager().getYAxisLabelRotation())); - Shape shape = axisLabelTextLayout.getOutline(rot); + Shape shape = axisLabelTextLayout.getOutline(null); Rectangle2D tickLabelBounds = shape.getBounds(); double flippedTickLocation = yOffset + height - tickLocation;