Skip to content
Snippets Groups Projects
Commit e381c68e authored by Tim Molter's avatar Tim Molter Committed by Niklas Polke
Browse files

remove rotating Y-Axis tick labels

parent 23ca04c9
No related branches found
No related tags found
No related merge requests found
...@@ -124,7 +124,6 @@ public class StyleManager { ...@@ -124,7 +124,6 @@ public class StyleManager {
private TextAlignment xAxisLabelAlignment = TextAlignment.Centre; private TextAlignment xAxisLabelAlignment = TextAlignment.Centre;
private TextAlignment yAxisLabelAlignment = TextAlignment.Left; private TextAlignment yAxisLabelAlignment = TextAlignment.Left;
private int xAxisLabelRotation = 0; private int xAxisLabelRotation = 0;
private int yAxisLabelRotation = 0;
// Chart Plot Area /////////////////////////////// // Chart Plot Area ///////////////////////////////
private boolean isPlotGridLinesVisible; private boolean isPlotGridLinesVisible;
...@@ -918,16 +917,6 @@ public class StyleManager { ...@@ -918,16 +917,6 @@ public class StyleManager {
this.xAxisLabelRotation = xAxisLabelRotation; this.xAxisLabelRotation = xAxisLabelRotation;
} }
public int getYAxisLabelRotation() {
return yAxisLabelRotation;
}
public void setYAxisLabelRotation(int yAxisLabelRotation) {
this.yAxisLabelRotation = yAxisLabelRotation;
}
// Chart Plot Area /////////////////////////////// // Chart Plot Area ///////////////////////////////
/** /**
......
...@@ -158,23 +158,23 @@ public class Axis implements ChartPart { ...@@ -158,23 +158,23 @@ public class Axis implements ChartPart {
getChartPainter().getWidth() getChartPainter().getWidth()
- width // y-axis approx. width - width // y-axis approx. width
- chartLegendWidth - chartLegendWidth
- 2 - 2
* getChartPainter().getStyleManager().getChartPadding() * 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() - (getChartPainter().getStyleManager().getLegendPosition() == LegendPosition.OutsideE && getChartPainter().getStyleManager().isLegendVisible() ? getChartPainter().getStyleManager()
.getChartPadding() : 0) .getChartPadding() : 0)
; ;
double height = double height =
getChartPainter().getHeight() - yOffset - axisPair.getXAxis().getXAxisHeightHint(approximateXAxisWidth) - getChartPainter().getStyleManager().getPlotPadding() 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); Rectangle2D yAxisRectangle = new Rectangle2D.Double(xOffset, yOffset, width, height);
this.paintZone = yAxisRectangle; this.paintZone = yAxisRectangle;
// g.setColor(Color.green); // g.setColor(Color.green);
...@@ -201,7 +201,7 @@ public class Axis implements ChartPart { ...@@ -201,7 +201,7 @@ public class Axis implements ChartPart {
double xOffset = double xOffset =
axisPair.getYAxis().getBounds().getWidth() + (getChartPainter().getStyleManager().isYAxisTicksVisible() ? getChartPainter().getStyleManager().getPlotPadding() : 0) 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 yOffset = axisPair.getYAxis().getBounds().getY() + axisPair.getYAxis().getBounds().getHeight() + getChartPainter().getStyleManager().getPlotPadding();
double chartLegendWidth = 0; double chartLegendWidth = 0;
...@@ -213,19 +213,19 @@ public class Axis implements ChartPart { ...@@ -213,19 +213,19 @@ public class Axis implements ChartPart {
getChartPainter().getWidth() getChartPainter().getWidth()
- axisPair.getYAxis().getBounds().getWidth() // y-axis was already painted - axisPair.getYAxis().getBounds().getWidth() // y-axis was already painted
- chartLegendWidth - chartLegendWidth
- 2 - 2
* getChartPainter().getStyleManager().getChartPadding() * 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() - (getChartPainter().getStyleManager().getLegendPosition() == LegendPosition.OutsideE && getChartPainter().getStyleManager().isLegendVisible() ? getChartPainter().getStyleManager()
.getChartPadding() : 0) .getChartPadding() : 0)
; ;
double height = this.getXAxisHeightHint(width); double height = this.getXAxisHeightHint(width);
Rectangle2D xAxisRectangle = new Rectangle2D.Double(xOffset, yOffset, width, height); Rectangle2D xAxisRectangle = new Rectangle2D.Double(xOffset, yOffset, width, height);
...@@ -248,6 +248,9 @@ public class Axis implements ChartPart { ...@@ -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 * @return
*/ */
private double getXAxisHeightHint(double workingSpace) { private double getXAxisHeightHint(double workingSpace) {
......
...@@ -89,9 +89,7 @@ public class AxisTickLabels implements ChartPart { ...@@ -89,9 +89,7 @@ public class AxisTickLabels implements ChartPart {
for (Double tickLocation : axisLabelTextLayouts.keySet()) { for (Double tickLocation : axisLabelTextLayouts.keySet()) {
TextLayout axisLabelTextLayout = axisLabelTextLayouts.get(tickLocation); TextLayout axisLabelTextLayout = axisLabelTextLayouts.get(tickLocation);
AffineTransform rot = Shape shape = axisLabelTextLayout.getOutline(null);
getChartPainter().getStyleManager().getYAxisLabelRotation() == 0 ? null : AffineTransform.getRotateInstance(-Math.toRadians(getChartPainter().getStyleManager().getYAxisLabelRotation()));
Shape shape = axisLabelTextLayout.getOutline(rot);
Rectangle2D tickLabelBounds = shape.getBounds(); Rectangle2D tickLabelBounds = shape.getBounds();
double flippedTickLocation = yOffset + height - tickLocation; double flippedTickLocation = yOffset + height - tickLocation;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment