diff --git a/xchart/src/main/java/com/xeiam/xchart/Chart.java b/xchart/src/main/java/com/xeiam/xchart/Chart.java index 683efe5ee85231eb42eadb17ba00e76aabaaaeed..c2f5b74915a7cf9be66b67f943c068b56375d452 100644 --- a/xchart/src/main/java/com/xeiam/xchart/Chart.java +++ b/xchart/src/main/java/com/xeiam/xchart/Chart.java @@ -62,9 +62,11 @@ public class Chart { if (chartTheme == ChartTheme.XChart) { setTheme(new XChartTheme()); - } else if (chartTheme == ChartTheme.GGPlot2) { + } + else if (chartTheme == ChartTheme.GGPlot2) { setTheme(new GGPlot2Theme()); - } else if (chartTheme == ChartTheme.Matlab) { + } + else if (chartTheme == ChartTheme.Matlab) { setTheme(new MatlabTheme()); } } diff --git a/xchart/src/main/java/com/xeiam/xchart/QuickChart.java b/xchart/src/main/java/com/xeiam/xchart/QuickChart.java index 659126eb8ab399b332084abf4db0af593bf71c7a..09efc6cda8f3dcda1e1f26fc0d73d7e41ca6995b 100644 --- a/xchart/src/main/java/com/xeiam/xchart/QuickChart.java +++ b/xchart/src/main/java/com/xeiam/xchart/QuickChart.java @@ -17,7 +17,6 @@ package com.xeiam.xchart; import java.util.Collection; - /** * A convenience class for making Charts with one line of code * @@ -51,7 +50,8 @@ public final class QuickChart { double[][] yData2d = { yData }; if (seriesName == null) { return getChart(chartTitle, xTitle, yTitle, null, xData, yData2d); - } else { + } + else { return getChart(chartTitle, xTitle, yTitle, new String[] { seriesName }, xData, yData2d); } } @@ -82,7 +82,8 @@ public final class QuickChart { Series series; if (seriesNames != null) { series = chart.addSeries(seriesNames[i], xData, yData[i]); - } else { + } + else { chart.getStyleManager().setLegendVisible(false); series = chart.addSeries(" " + i, xData, yData[i]); } diff --git a/xchart/src/main/java/com/xeiam/xchart/Series.java b/xchart/src/main/java/com/xeiam/xchart/Series.java index 185e1646118ba7b76651f6c5f6e58eab18df7210..26504f6e4d832cb5c30ecfef9070c33f1e7eb6c7 100644 --- a/xchart/src/main/java/com/xeiam/xchart/Series.java +++ b/xchart/src/main/java/com/xeiam/xchart/Series.java @@ -99,7 +99,8 @@ public class Series { BigDecimal[] yMinMax = null; if (errorBars == null) { yMinMax = findMinMax(yData, yAxisType); - } else { + } + else { yMinMax = findMinMaxWithErrorBars(yData, errorBars); } yMin = yMinMax[0]; @@ -130,10 +131,12 @@ public class Series { if (axisType == AxisType.Number) { bigDecimal = new BigDecimal(((Number) dataPoint).toString()); - } else if (axisType == AxisType.Date) { + } + else if (axisType == AxisType.Date) { Date date = (Date) dataPoint; bigDecimal = new BigDecimal(date.getTime()); - } else if (axisType == AxisType.String) { + } + else if (axisType == AxisType.String) { return new BigDecimal[] { null, null }; } if (min == null || bigDecimal.compareTo(min) < 0) { diff --git a/xchart/src/main/java/com/xeiam/xchart/SwingWrapper.java b/xchart/src/main/java/com/xeiam/xchart/SwingWrapper.java index 109ff8e5f6bb28cc407ed715015801c2580c2d57..73fd24660dd3488f71ff75f31279b46a029ffe2f 100644 --- a/xchart/src/main/java/com/xeiam/xchart/SwingWrapper.java +++ b/xchart/src/main/java/com/xeiam/xchart/SwingWrapper.java @@ -116,7 +116,8 @@ public class SwingWrapper { if (chart != null) { JPanel chartPanel = new XChartPanel(chart); frame.add(chartPanel); - } else { + } + else { JPanel chartPanel = new JPanel(); frame.getContentPane().add(chartPanel); } 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 97765416fc4821194ac88cf0e09382baa0660f91..ebab2deda8dc63cba9b2c8ce9bc06c666679ec25 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 @@ -140,7 +140,8 @@ public class Axis implements ChartPart { axisTickLabelsHeight = rectangle.getHeight() + getChartPainter().getStyleManager().getAxisTickPadding() + getChartPainter().getStyleManager().getAxisTickMarkLength(); } return titleHeight + axisTickLabelsHeight; - } else { // Y-Axis + } + else { // Y-Axis return 0; // We layout the yAxis first depending in the xAxis height hint. We don't care about the yAxis height hint } } @@ -165,8 +166,8 @@ public class Axis implements ChartPart { double yOffset = getChartPainter().getChartTitle().getSizeHint(); double width = 80; // arbitrary, final width depends on Axis tick labels - double height = getChartPainter().getHeight() - yOffset - axisPair.getxAxis().getSizeHint() - getChartPainter().getStyleManager().getPlotPadding() - - getChartPainter().getStyleManager().getChartPadding(); + double height = + getChartPainter().getHeight() - yOffset - axisPair.getxAxis().getSizeHint() - getChartPainter().getStyleManager().getPlotPadding() - getChartPainter().getStyleManager().getChartPadding(); Rectangle2D yAxisRectangle = new Rectangle2D.Double(xOffset, yOffset, width, height); this.paintZone = yAxisRectangle; @@ -186,13 +187,15 @@ public class Axis implements ChartPart { // g.setColor(Color.yellow); // g.draw(bounds); - } else { // X-Axis + } + else { // X-Axis // calculate paint zone // |____________________| - double xOffset = axisPair.getyAxis().getBounds().getWidth() + (getChartPainter().getStyleManager().isYAxisTicksVisible() ? getChartPainter().getStyleManager().getPlotPadding() : 0) - + getChartPainter().getStyleManager().getChartPadding(); + double xOffset = + axisPair.getyAxis().getBounds().getWidth() + (getChartPainter().getStyleManager().isYAxisTicksVisible() ? getChartPainter().getStyleManager().getPlotPadding() : 0) + + getChartPainter().getStyleManager().getChartPadding(); double yOffset = axisPair.getyAxis().getBounds().getY() + axisPair.getyAxis().getBounds().getHeight() + getChartPainter().getStyleManager().getPlotPadding(); double chartLegendWidth = 0; @@ -202,19 +205,19 @@ public class Axis implements ChartPart { double width = - getChartPainter().getWidth() + getChartPainter().getWidth() - - axisPair.getyAxis().getBounds().getWidth() + - axisPair.getyAxis().getBounds().getWidth() - - 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) ; diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisPair.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisPair.java index 57c4d31916ca056cdad4f2d58129848ec6e85ee5..37d18f2c3153c131794b7c36290733507df28d75 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisPair.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisPair.java @@ -87,14 +87,17 @@ public class AxisPair implements ChartPart { Object dataPoint = itr.next(); if (dataPoint instanceof Number) { xAxis.setAxisType(AxisType.Number); - } else if (dataPoint instanceof Date) { + } + else if (dataPoint instanceof Date) { xAxis.setAxisType(AxisType.Date); - } else if (dataPoint instanceof String) { + } + else if (dataPoint instanceof String) { xAxis.setAxisType(AxisType.String); } yAxis.setAxisType(AxisType.Number); series = new Series(seriesName, xData, xAxis.getAxisType(), yData, yAxis.getAxisType(), errorBars, seriesColorMarkerLineStyleCycler.getNextSeriesColorMarkerLineStyle()); - } else { // generate xData + } + else { // generate xData Collection<Number> generatedXData = new ArrayList<Number>(); for (int i = 1; i < yData.size() + 1; i++) { generatedXData.add(i); diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTick.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTick.java index 83f547b6cf5b61c43da3b2449f76caf3291d712f..5598158bf407d1e149dd58e45778e48a8f959c86 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTick.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTick.java @@ -66,7 +66,8 @@ public class AxisTick implements ChartPart { if (axis.getDirection() == Axis.Direction.Y) { workingSpace = (int) axis.getPaintZone().getHeight(); // number of pixels the axis has to work with for drawing AxisTicks // System.out.println("workingspace= " + workingSpace); - } else if (axis.getDirection() == Axis.Direction.X) { + } + else if (axis.getDirection() == Axis.Direction.X) { workingSpace = (int) axis.getPaintZone().getWidth(); // number of pixels the axis has to work with for drawing AxisTicks // System.out.println("workingspace= " + workingSpace); } @@ -75,19 +76,23 @@ public class AxisTick implements ChartPart { gridStep = new AxisTickBarChartCalculator(axis.getDirection(), workingSpace, axis.getMin(), axis.getMax(), getChartPainter()); - } else if (axis.getDirection() == Axis.Direction.X && getChartPainter().getStyleManager().isXAxisLogarithmic() && axis.getAxisType() != AxisType.Date) { + } + else if (axis.getDirection() == Axis.Direction.X && getChartPainter().getStyleManager().isXAxisLogarithmic() && axis.getAxisType() != AxisType.Date) { gridStep = new AxisTickLogarithmicCalculator(axis.getDirection(), workingSpace, axis.getMin(), axis.getMax(), getChartPainter().getStyleManager()); - } else if (axis.getDirection() == Axis.Direction.Y && getChartPainter().getStyleManager().isYAxisLogarithmic() && axis.getAxisType() != AxisType.Date) { + } + else if (axis.getDirection() == Axis.Direction.Y && getChartPainter().getStyleManager().isYAxisLogarithmic() && axis.getAxisType() != AxisType.Date) { gridStep = new AxisTickLogarithmicCalculator(axis.getDirection(), workingSpace, axis.getMin(), axis.getMax(), getChartPainter().getStyleManager()); - } else if (axis.getAxisType() == AxisType.Number) { + } + else if (axis.getAxisType() == AxisType.Number) { gridStep = new AxisTickNumericalCalculator(axis.getDirection(), workingSpace, axis.getMin(), axis.getMax(), getChartPainter().getStyleManager()); - } else if (axis.getAxisType() == AxisType.Date) { + } + else if (axis.getAxisType() == AxisType.Date) { gridStep = new AxisTickDateCalculator(axis.getDirection(), workingSpace, axis.getMin(), axis.getMax(), getChartPainter().getStyleManager()); @@ -113,13 +118,15 @@ public class AxisTick implements ChartPart { // g.setColor(Color.red); // g.draw(bounds); - } else if (axis.getDirection() == Axis.Direction.X && getChartPainter().getStyleManager().isXAxisTicksVisible()) { + } + else if (axis.getDirection() == Axis.Direction.X && getChartPainter().getStyleManager().isXAxisTicksVisible()) { axisTickLabels.paint(g); axisTickMarks.paint(g); - bounds = new Rectangle2D.Double(axisTickMarks.getBounds().getX(), axisTickMarks.getBounds().getY(), axisTickLabels.getBounds().getWidth(), axisTickMarks.getBounds().getHeight() - + getChartPainter().getStyleManager().getAxisTickPadding() + axisTickLabels.getBounds().getHeight()); + bounds = + new Rectangle2D.Double(axisTickMarks.getBounds().getX(), axisTickMarks.getBounds().getY(), axisTickLabels.getBounds().getWidth(), axisTickMarks.getBounds().getHeight() + + getChartPainter().getStyleManager().getAxisTickPadding() + axisTickLabels.getBounds().getHeight()); // g.setColor(Color.red); // g.draw(bounds); 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 14d2cba906588f7e8efcd697d6cbabc2805936ac..5b41ecd7a5c707414b0b59cc7294f340cb02fc85 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 @@ -83,7 +83,8 @@ public class AxisTickLabels implements ChartPart { // g.setColor(Color.blue); // g.draw(bounds); - } else if (axisTick.getAxis().getDirection() == Axis.Direction.X && getChartPainter().getStyleManager().isXAxisTicksVisible()) { // X-Axis + } + else if (axisTick.getAxis().getDirection() == Axis.Direction.X && getChartPainter().getStyleManager().isXAxisTicksVisible()) { // X-Axis double xOffset = axisTick.getAxis().getPaintZone().getX(); double yOffset = axisTick.getAxis().getAxisTitle().getBounds().getY(); diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickMarks.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickMarks.java index cdeedc3fc04bd19cf0829ace0aedd2c9c725eb1a..a77c06698dbec42725d0d899f2929b9868fbc18a 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickMarks.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickMarks.java @@ -65,8 +65,9 @@ public class AxisTickMarks implements ChartPart { int tickLocation = axisTick.getTickLocations().get(i); - Shape line = new Line2D.Double(xOffset, yOffset + axisTick.getAxis().getPaintZone().getHeight() - tickLocation, xOffset + getChartPainter().getStyleManager().getAxisTickMarkLength(), - yOffset + axisTick.getAxis().getPaintZone().getHeight() - tickLocation); + Shape line = + new Line2D.Double(xOffset, yOffset + axisTick.getAxis().getPaintZone().getHeight() - tickLocation, xOffset + getChartPainter().getStyleManager().getAxisTickMarkLength(), yOffset + + axisTick.getAxis().getPaintZone().getHeight() - tickLocation); g.draw(line); } @@ -74,8 +75,9 @@ public class AxisTickMarks implements ChartPart { // Line if (getChartPainter().getStyleManager().isAxisTicksLineVisible()) { - Shape line = new Line2D.Double(xOffset + getChartPainter().getStyleManager().getAxisTickMarkLength(), yOffset, xOffset + getChartPainter().getStyleManager().getAxisTickMarkLength(), yOffset - + axisTick.getAxis().getPaintZone().getHeight()); + Shape line = + new Line2D.Double(xOffset + getChartPainter().getStyleManager().getAxisTickMarkLength(), yOffset, xOffset + getChartPainter().getStyleManager().getAxisTickMarkLength(), yOffset + + axisTick.getAxis().getPaintZone().getHeight()); g.draw(line); } @@ -85,7 +87,8 @@ public class AxisTickMarks implements ChartPart { // g.setColor(Color.yellow); // g.draw(bounds); - } else if (axisTick.getAxis().getDirection() == Axis.Direction.X && getChartPainter().getStyleManager().isXAxisTicksVisible()) { // X-Axis + } + else if (axisTick.getAxis().getDirection() == Axis.Direction.X && getChartPainter().getStyleManager().isXAxisTicksVisible()) { // X-Axis double xOffset = axisTick.getAxis().getPaintZone().getX(); double yOffset = axisTick.getAxisTickLabels().getBounds().getY() - getChartPainter().getStyleManager().getAxisTickPadding(); @@ -104,14 +107,16 @@ public class AxisTickMarks implements ChartPart { // Line if (getChartPainter().getStyleManager().isAxisTicksLineVisible()) { - Shape line = new Line2D.Double(xOffset, yOffset - getChartPainter().getStyleManager().getAxisTickMarkLength(), xOffset + axisTick.getAxis().getPaintZone().getWidth(), yOffset - - getChartPainter().getStyleManager().getAxisTickMarkLength()); + Shape line = + new Line2D.Double(xOffset, yOffset - getChartPainter().getStyleManager().getAxisTickMarkLength(), xOffset + axisTick.getAxis().getPaintZone().getWidth(), yOffset + - getChartPainter().getStyleManager().getAxisTickMarkLength()); g.draw(line); } // bounds - bounds = new Rectangle2D.Double(xOffset, yOffset - getChartPainter().getStyleManager().getAxisTickMarkLength(), axisTick.getAxis().getPaintZone().getWidth(), getChartPainter().getStyleManager() - .getAxisTickMarkLength()); + bounds = + new Rectangle2D.Double(xOffset, yOffset - getChartPainter().getStyleManager().getAxisTickMarkLength(), axisTick.getAxis().getPaintZone().getWidth(), getChartPainter().getStyleManager() + .getAxisTickMarkLength()); // g.setColor(Color.yellow); // g.draw(bounds); } diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTitle.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTitle.java index ac58fc3f050216ab665bdd23a8ac7ce0637f1988..9bf09daf4ed98a92217dcffc8eb0f182e142530b 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTitle.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTitle.java @@ -80,15 +80,18 @@ public class AxisTitle implements ChartPart { // System.out.println(nonRotatedRectangle.getHeight()); // bounds - bounds = new Rectangle2D.Double(xOffset - nonRotatedRectangle.getHeight(), yOffset - nonRotatedRectangle.getWidth(), nonRotatedRectangle.getHeight() - + getChartPainter().getStyleManager().getAxisTitlePadding(), nonRotatedRectangle.getWidth()); + bounds = + new Rectangle2D.Double(xOffset - nonRotatedRectangle.getHeight(), yOffset - nonRotatedRectangle.getWidth(), nonRotatedRectangle.getHeight() + + getChartPainter().getStyleManager().getAxisTitlePadding(), nonRotatedRectangle.getWidth()); // g.setColor(Color.blue); // g.draw(bounds); - } else { + } + else { bounds = new Rectangle2D.Double(axis.getPaintZone().getX(), axis.getPaintZone().getY(), 0, axis.getPaintZone().getHeight()); } - } else { + } + else { if (text != null && !text.trim().equalsIgnoreCase("") && getChartPainter().getStyleManager().isXAxisTitleVisible()) { @@ -102,12 +105,14 @@ public class AxisTitle implements ChartPart { textLayout.draw(g, (float) xOffset, (float) (yOffset - rectangle.getY())); - bounds = new Rectangle2D.Double(xOffset, yOffset - getChartPainter().getStyleManager().getAxisTitlePadding(), rectangle.getWidth(), rectangle.getHeight() - + getChartPainter().getStyleManager().getAxisTitlePadding()); + bounds = + new Rectangle2D.Double(xOffset, yOffset - getChartPainter().getStyleManager().getAxisTitlePadding(), rectangle.getWidth(), rectangle.getHeight() + + getChartPainter().getStyleManager().getAxisTitlePadding()); // g.setColor(Color.blue); // g.draw(bounds); - } else { + } + else { bounds = new Rectangle2D.Double(axis.getPaintZone().getX(), axis.getPaintZone().getY() + axis.getPaintZone().getHeight(), axis.getPaintZone().getWidth(), 0); // g.setColor(Color.blue); // g.draw(bounds); diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/ChartTitle.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/ChartTitle.java index 0e68beace09213e1e50a17ad95a9a9b185794ebe..461a54d732fa1161631364994da655bde6d6004e 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/ChartTitle.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/ChartTitle.java @@ -55,7 +55,8 @@ public class ChartTitle implements ChartPart { if (text.trim().equalsIgnoreCase("")) { chartPainter.getStyleManager().setChartTitleVisible(false); - } else { + } + else { chartPainter.getStyleManager().setChartTitleVisible(true); } this.text = text; @@ -74,7 +75,8 @@ public class ChartTitle implements ChartPart { Rectangle2D rectangle = textLayout.getBounds(); int titleHeight = (int) ((chartPainter.getStyleManager().isChartTitleVisible() ? rectangle.getHeight() : 0)); return chartPainter.getStyleManager().getChartPadding() + 2 * chartPainter.getStyleManager().getChartTitlePadding() + titleHeight; - } else { + } + else { return chartPainter.getStyleManager().getChartPadding(); } } diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Legend.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Legend.java index 0f56d50e7fa21a644ea080b235f1d9cfaf725e27..02cab6faa4e5b96c24e8b7c79bdf1386a9ce1355 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Legend.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Legend.java @@ -84,7 +84,8 @@ public class Legend implements ChartPart { double maxContentHeight = 0; if (getChartPainter().getStyleManager().getChartType() != ChartType.Bar) { maxContentHeight = Math.max(legendTextContentMaxHeight, Marker.SIZE); - } else { + } + else { maxContentHeight = Math.max(legendTextContentMaxHeight, BOX_SIZE); } double legendContentHeight = maxContentHeight * seriesMap.size() + chartPainter.getStyleManager().getLegendPadding() * (seriesMap.size() - 1); @@ -93,14 +94,16 @@ public class Legend implements ChartPart { double legendContentWidth = 0; if (getChartPainter().getStyleManager().getChartType() != ChartType.Bar) { legendContentWidth = 3.0 * Marker.SIZE + chartPainter.getStyleManager().getLegendPadding() + legendTextContentMaxWidth; - } else { + } + else { legendContentWidth = BOX_SIZE + chartPainter.getStyleManager().getLegendPadding() + legendTextContentMaxWidth; } // Legend Box double legendBoxWidth = legendContentWidth + 2 * chartPainter.getStyleManager().getLegendPadding(); double legendBoxHeight = legendContentHeight + 2 * chartPainter.getStyleManager().getLegendPadding(); return new double[] { legendBoxWidth, legendBoxHeight, maxContentHeight }; - } else { + } + else { return new double[] { 0, 0, 0 }; } } @@ -175,7 +178,8 @@ public class Legend implements ChartPart { g.setColor(series.getMarkerColor()); series.getMarker().paint(g, startx + (Marker.SIZE * 1.5), starty + maxContentHeight / 2.0); } - } else { + } + else { // paint little box if (series.getStroke() != null) { g.setColor(series.getStrokeColor()); @@ -191,7 +195,8 @@ public class Legend implements ChartPart { if (getChartPainter().getStyleManager().getChartType() != ChartType.Bar) { layout.draw(g, (float) (startx + Marker.SIZE + (Marker.SIZE * 1.5) + chartPainter.getStyleManager().getLegendPadding()), (float) (starty + (maxContentHeight - 1 + layout.getBounds() .getHeight()) / 2.0)); - } else { + } + else { layout.draw(g, (float) (startx + BOX_SIZE + chartPainter.getStyleManager().getLegendPadding()), (float) (starty + (maxContentHeight + layout.getBounds().getHeight()) / 2.0)); } starty = starty + maxContentHeight + chartPainter.getStyleManager().getLegendPadding(); diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Plot.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Plot.java index 03c7f416227ca8254e4d250b934afc313dc8365e..686e4e370056d4f733ace6bd3d3c713f8e278c6e 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Plot.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Plot.java @@ -77,7 +77,8 @@ public class Plot implements ChartPart { plotSurface.paint(g); if (getChartPainter().getStyleManager().getChartType() == ChartType.Bar) { this.plotContent = new PlotContentBarChart(this); - } else { + } + else { this.plotContent = new PlotContentLineChart(this); } plotContent.paint(g);