diff --git a/xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTick.java b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTick.java index be540b5cf211ea43be753051fdf64e8c87885c28..469d10c010484f38d8dced2e029b6d291f129a5b 100644 --- a/xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTick.java +++ b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/AxisTick.java @@ -57,18 +57,18 @@ public class AxisTick implements ChartPart { @Override public void paint(Graphics2D g) { - double workingSpace = 0.0; - // Y-Axis - if (axis.getDirection() == Axis.Direction.Y) { - workingSpace = axis.getPaintZone().getHeight(); // number of pixels the axis has to work with for drawing AxisTicks - // System.out.println("workingspace= " + workingSpace); - } - // X-Axis - else if (axis.getDirection() == Axis.Direction.X) { - workingSpace = axis.getPaintZone().getWidth(); // number of pixels the axis has to work with for drawing AxisTicks - // System.out.println("workingspace= " + workingSpace); - } - + // double workingSpace = 0.0; + // // Y-Axis + // if (axis.getDirection() == Axis.Direction.Y) { + // workingSpace = axis.getPaintZone().getHeight(); // number of pixels the axis has to work with for drawing AxisTicks + // // System.out.println("workingspace= " + workingSpace); + // } + // // X-Axis + // else if (axis.getDirection() == Axis.Direction.X) { + // workingSpace = axis.getPaintZone().getWidth(); // number of pixels the axis has to work with for drawing AxisTicks + // // System.out.println("workingspace= " + workingSpace); + // } + // // System.out.println("AxisTick: " + axis.getDirection()); // System.out.println("workingSpace: " + workingSpace); @@ -98,8 +98,17 @@ public class AxisTick implements ChartPart { axisTickLabels.paint(g); axisTickMarks.paint(g); - bounds = new Rectangle2D.Double(axisTickMarks.getBounds().getX(), axisTickMarks.getBounds().getY(), axisTickLabels.getBounds().getWidth(), axisTickMarks.getBounds().getHeight() - + getChartInternal().getStyleManager().getAxisTickPadding() + axisTickLabels.getBounds().getHeight()); + bounds = new Rectangle2D.Double( + + axisTickMarks.getBounds().getX(), + + axisTickMarks.getBounds().getY(), + + axisTickLabels.getBounds().getWidth(), + + axisTickMarks.getBounds().getHeight() + getChartInternal().getStyleManager().getAxisTickPadding() + axisTickLabels.getBounds().getHeight() + + ); // g.setColor(Color.red); // g.draw(bounds); diff --git a/xchart/src/main/java/org/knowm/xchart/internal/chartpart/PlotContentCategoricalChart.java b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/PlotContentCategoricalChart.java index 3f1f88f2e13e8285bcf55bd44030ec2e4b998760..af0a421f01294f7849e507949b61e195f3855c33 100644 --- a/xchart/src/main/java/org/knowm/xchart/internal/chartpart/PlotContentCategoricalChart.java +++ b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/PlotContentCategoricalChart.java @@ -53,7 +53,7 @@ public class PlotContentCategoricalChart extends PlotContent { // g.setColor(Color.red); // g.draw(bounds); - StyleManager styleManager = plot.getChartInternal().getStyleManager(); + StyleManager styleManager = getChartInternal().getStyleManager(); // this is for preventing the series to be drawn outside the plot area if min and max is overridden to fall inside the data range Rectangle rectangle = new Rectangle(0, 0, getChartInternal().getWidth(), getChartInternal().getHeight()); @@ -70,8 +70,8 @@ public class PlotContentCategoricalChart extends PlotContent { double yTickSpace = styleManager.getAxisTickSpacePercentage() * bounds.getHeight(); double yTopMargin = Utils.getTickStartOffset(bounds.getHeight(), yTickSpace); - int numBars = getChartInternal().getSeriesMap().values().iterator().next().getXData().size(); - double gridStep = xTickSpace / numBars; + int numCategories = getChartInternal().getSeriesMap().values().iterator().next().getXData().size(); + double gridStep = xTickSpace / numCategories; // plot series int seriesCounter = 0; diff --git a/xchart/src/main/java/org/knowm/xchart/internal/chartpart/PlotContentNumericalChart.java b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/PlotContentNumericalChart.java index 64013caca6b76eb464aa6a8cc3367fd99a244fae..468df77274d9fb57868eadb02c220ee9e6741b54 100644 --- a/xchart/src/main/java/org/knowm/xchart/internal/chartpart/PlotContentNumericalChart.java +++ b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/PlotContentNumericalChart.java @@ -59,7 +59,7 @@ public class PlotContentNumericalChart extends PlotContent { return; } - StyleManager styleManager = plot.getChartInternal().getStyleManager(); + StyleManager styleManager = getChartInternal().getStyleManager(); // this is for preventing the series to be drawn outside the plot area if min and max is overridden to fall inside the data range