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 {
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 ///////////////////////////////
/**
......
......@@ -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) {
......
......@@ -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;
......
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