diff --git a/src/main/java/com/xeiam/xchart/Axis.java b/src/main/java/com/xeiam/xchart/Axis.java index 92fa4e0fdf0ffe4b315657287d0585c779cf5409..539a6e53668d76e7d25050176450513254378d29 100644 --- a/src/main/java/com/xeiam/xchart/Axis.java +++ b/src/main/java/com/xeiam/xchart/Axis.java @@ -35,11 +35,11 @@ public class Axis implements IChartPart { NUMBER, DATE; } - /** the axisPair */ + /** parent */ protected AxisPair axisPair; - /** the seriesType */ - private AxisType axisType; + /** the axisType */ + protected AxisType axisType; /** the axis title */ protected AxisTitle axisTitle; @@ -48,11 +48,11 @@ public class Axis implements IChartPart { protected AxisTick axisTick; /** the axis direction */ - private Direction direction; + protected Direction direction; - private BigDecimal min = null; + protected BigDecimal min = null; - private BigDecimal max = null; + protected BigDecimal max = null; /** the bounds */ private Rectangle bounds; @@ -61,7 +61,7 @@ public class Axis implements IChartPart { private Rectangle paintZone; /** An axis direction */ - public enum Direction { + protected enum Direction { /** the constant to represent X axis */ X, @@ -76,7 +76,7 @@ public class Axis implements IChartPart { * @param direction the axis direction (X or Y) * @param chart the chart */ - public Axis(AxisPair axisPair, Direction direction) { + protected Axis(AxisPair axisPair, Direction direction) { this.axisPair = axisPair; this.direction = direction; @@ -89,7 +89,7 @@ public class Axis implements IChartPart { * @param min * @param max */ - public void addMinMax(BigDecimal min, BigDecimal max) { + protected void addMinMax(BigDecimal min, BigDecimal max) { // System.out.println(min); // System.out.println(max); @@ -104,7 +104,7 @@ public class Axis implements IChartPart { // System.out.println(this.max); } - public void setAxisType(AxisType axisType) { + protected void setAxisType(AxisType axisType) { if (this.axisType != null && this.axisType != axisType) { throw new IllegalArgumentException("Date and Number Axes cannot be mixed on the same chart!! "); @@ -112,23 +112,13 @@ public class Axis implements IChartPart { this.axisType = axisType; } - public AxisType getAxisType() { - - return axisType; - } - - public Direction getDirection() { - - return direction; - } - @Override public Rectangle getBounds() { return bounds; } - public Rectangle getPaintZone() { + protected Rectangle getPaintZone() { return paintZone; } @@ -138,30 +128,20 @@ public class Axis implements IChartPart { return axisTitle; } - public void setAxisTitle(String title) { + protected void setAxisTitle(String title) { this.axisTitle.setText(title); } - public void setAxisTitle(AxisTitle axisTitle) { + protected void setAxisTitle(AxisTitle axisTitle) { this.axisTitle = axisTitle; } - public BigDecimal getMin() { - - return min; - } - - public BigDecimal getMax() { - - return max; - } - /** * @return */ - public int getSizeHint() { + protected int getSizeHint() { if (direction == Direction.X) { // X-Axis @@ -176,7 +156,7 @@ public class Axis implements IChartPart { // Axis tick labels double axisTickLabelsHeight = 0.0; if (axisTick.isVisible) { - TextLayout textLayout = new TextLayout("0", axisTick.getAxisTickLabels().font, new FontRenderContext(null, true, false)); + TextLayout textLayout = new TextLayout("0", axisTick.axisTickLabels.font, new FontRenderContext(null, true, false)); Rectangle rectangle = textLayout.getPixelBounds(null, 0, 0); axisTickLabelsHeight = rectangle.getHeight() + AxisTick.AXIS_TICK_PADDING + AxisTickMarks.TICK_LENGTH + Plot.PLOT_PADDING; } @@ -205,7 +185,7 @@ public class Axis implements IChartPart { int xOffset = Chart.CHART_PADDING; int yOffset = (int) (axisPair.getChartTitleBounds().getY() + axisPair.getChartTitleBounds().getHeight() + Chart.CHART_PADDING); int width = 80; // arbitrary, final width depends on Axis tick labels - int height = axisPair.chart.getHeight() - yOffset - axisPair.getXAxis().getSizeHint() - Chart.CHART_PADDING; + int height = axisPair.chart.height - yOffset - axisPair.xAxis.getSizeHint() - Chart.CHART_PADDING; Rectangle yAxisRectangle = new Rectangle(xOffset, yOffset, width, height); this.paintZone = yAxisRectangle; // g.setColor(Color.green); @@ -228,9 +208,9 @@ public class Axis implements IChartPart { // calculate paint zone // |____________________| - int xOffset = (int) (axisPair.getYAxis().getBounds().getWidth() + (axisPair.getYAxis().axisTick.isVisible ? Plot.PLOT_PADDING : 0) + Chart.CHART_PADDING); - int yOffset = (int) (axisPair.getYAxis().getBounds().getY() + axisPair.getYAxis().getBounds().getHeight()); - int width = (int) (axisPair.chart.getWidth() - axisPair.getYAxis().getBounds().getWidth() - axisPair.getChartLegendBounds().getWidth() - (axisPair.chart.getLegend().isVisible ? 3 : 2) * Chart.CHART_PADDING); + int xOffset = (int) (axisPair.yAxis.getBounds().getWidth() + (axisPair.yAxis.axisTick.isVisible ? Plot.PLOT_PADDING : 0) + Chart.CHART_PADDING); + int yOffset = (int) (axisPair.yAxis.getBounds().getY() + axisPair.yAxis.getBounds().getHeight()); + int width = (int) (axisPair.chart.width - axisPair.yAxis.getBounds().getWidth() - axisPair.getChartLegendBounds().getWidth() - (axisPair.chart.chartLegend.isVisible ? 3 : 2) * Chart.CHART_PADDING); int height = this.getSizeHint(); Rectangle xAxisRectangle = new Rectangle(xOffset, yOffset, width, height); this.paintZone = xAxisRectangle; diff --git a/src/main/java/com/xeiam/xchart/AxisPair.java b/src/main/java/com/xeiam/xchart/AxisPair.java index 8a541ab56f38abe32cd9fa071b0d1d555f08371a..fa6b6f352d3171cb219c900e1ef9d2fab6920111 100644 --- a/src/main/java/com/xeiam/xchart/AxisPair.java +++ b/src/main/java/com/xeiam/xchart/AxisPair.java @@ -33,24 +33,25 @@ import com.xeiam.xchart.series.Series; */ public class AxisPair implements IChartPart { - /** the chart */ + /** parent */ protected Chart chart; - private Map<Integer, Series> seriesMap = new LinkedHashMap<Integer, Series>(); + protected Map<Integer, Series> seriesMap = new LinkedHashMap<Integer, Series>(); - int seriesCount = 0; + private int seriesCount; - Axis xAxis; - Axis yAxis; + protected Axis xAxis; + protected Axis yAxis; /** * Constructor. * * @param chart the chart */ - public AxisPair(Chart chart) { + protected AxisPair(Chart chart) { this.chart = chart; + seriesCount = 0; // add axes xAxis = new Axis(this, Axis.Direction.X); @@ -62,7 +63,7 @@ public class AxisPair implements IChartPart { * @param xData * @param yData */ - public <T> Series addSeries(String seriesName, Collection<T> xData, Collection<Number> yData, Collection<Number> errorBars) { + protected <T> Series addSeries(String seriesName, Collection<T> xData, Collection<Number> yData, Collection<Number> errorBars) { // Sanity checks if (seriesName == null) { @@ -89,7 +90,7 @@ public class AxisPair implements IChartPart { xAxis.setAxisType(AxisType.DATE); } yAxis.setAxisType(AxisType.NUMBER); - series = new Series(seriesName, xData, xAxis.getAxisType(), yData, yAxis.getAxisType(), errorBars); + series = new Series(seriesName, xData, xAxis.axisType, yData, yAxis.axisType, errorBars); } else { // generate xData Collection<Number> generatedXData = new ArrayList<Number>(); for (int i = 1; i < yData.size(); i++) { @@ -97,7 +98,7 @@ public class AxisPair implements IChartPart { } xAxis.setAxisType(AxisType.NUMBER); yAxis.setAxisType(AxisType.NUMBER); - series = new Series(seriesName, generatedXData, xAxis.getAxisType(), yData, yAxis.getAxisType(), errorBars); + series = new Series(seriesName, generatedXData, xAxis.axisType, yData, yAxis.axisType, errorBars); } // Sanity check @@ -117,38 +118,23 @@ public class AxisPair implements IChartPart { return series; } - protected Axis getXAxis() { - - return xAxis; - } - - protected Axis getYAxis() { - - return yAxis; - } - protected Rectangle getChartTitleBounds() { - return chart.getTitle().getBounds(); + return chart.chartTitle.getBounds(); } protected Rectangle getChartLegendBounds() { - return chart.getLegend().getBounds(); - } - - protected Map<Integer, Series> getSeriesMap() { - - return seriesMap; + return chart.chartLegend.getBounds(); } - public static int getTickSpace(int workingSpace) { + protected static int getTickSpace(int workingSpace) { int tickSpace = (int) (workingSpace * 0.95); return tickSpace; } - public static int getMargin(int workingSpace, int tickSpace) { + protected static int getMargin(int workingSpace, int tickSpace) { int marginSpace = workingSpace - tickSpace; int margin = (int) (marginSpace / 2.0); diff --git a/src/main/java/com/xeiam/xchart/AxisTick.java b/src/main/java/com/xeiam/xchart/AxisTick.java index 314e7f8501a67afbc55ed540a65c13196b523760..05cafb641cf067069d59416997fa40ddecb2dfe5 100644 --- a/src/main/java/com/xeiam/xchart/AxisTick.java +++ b/src/main/java/com/xeiam/xchart/AxisTick.java @@ -33,29 +33,29 @@ import com.xeiam.xchart.interfaces.IHideable; */ public class AxisTick implements IChartPart, IHideable { - /** the axis */ + /** the default tick mark step hint */ + private static final int DEFAULT_TICK_MARK_STEP_HINT = 64; + + /** the padding between the tick labels and the tick marks */ + protected final static int AXIS_TICK_PADDING = 4; + + /** parent */ protected Axis axis; /** the axisticklabels */ protected AxisTickLabels axisTickLabels; /** the axistickmarks */ - private AxisTickMarks axisTickMarks; + protected AxisTickMarks axisTickMarks; /** the arraylist of tick label position in pixels */ - private List<Integer> tickLocations; + protected List<Integer> tickLocations; - /** the arraylist of tick label vales */ - private List<String> tickLabels; + /** the arraylist of tick label values */ + protected List<String> tickLabels; private int workingSpace; - /** the default tick mark step hint */ - private static final int DEFAULT_TICK_MARK_STEP_HINT = 64; - - /** the padding between the tick labels and the tick marks */ - protected final static int AXIS_TICK_PADDING = 4; - /** the normal format for tick labels */ private Format normalFormat = new DecimalFormat("#.###########"); @@ -85,43 +85,18 @@ public class AxisTick implements IChartPart, IHideable { } - public AxisTickLabels getAxisTickLabels() { - - return axisTickLabels; - } - - public AxisTickMarks getAxisTickMarks() { - - return axisTickMarks; - } - - public List<String> getTickLabels() { - - return tickLabels; - } - - public List<Integer> getTickLocations() { - - return tickLocations; - } - @Override public Rectangle getBounds() { return bounds; } - protected int getWorkingSpace() { - - return this.workingSpace; - } - @Override public void paint(Graphics2D g) { bounds = new Rectangle(); - if (axis.getDirection() == Axis.Direction.Y) { + if (axis.direction == 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 { @@ -142,7 +117,7 @@ public class AxisTick implements IChartPart, IHideable { axisTickLabels.paint(g); axisTickMarks.paint(g); - if (axis.getDirection() == Axis.Direction.Y) { + if (axis.direction == Axis.Direction.Y) { bounds = new Rectangle((int) axisTickLabels.getBounds().getX(), (int) (axisTickLabels.getBounds().getY()), (int) (axisTickLabels.getBounds().getWidth() + AXIS_TICK_PADDING + axisTickMarks.getBounds().getWidth()), (int) (axisTickMarks.getBounds().getHeight())); // g.setColor(Color.red); @@ -173,12 +148,12 @@ public class AxisTick implements IChartPart, IHideable { int margin = AxisPair.getMargin(workingSpace, tickSpace); // a check if all axis data are the exact same values - if (axis.getMax() == axis.getMin()) { - tickLabels.add(format(axis.getMax())); + if (axis.max == axis.min) { + tickLabels.add(format(axis.max)); tickLocations.add((int) (margin + tickSpace / 2.0)); } else { - final BigDecimal MIN = new BigDecimal(axis.getMin().doubleValue()); + final BigDecimal MIN = new BigDecimal(axis.min.doubleValue()); BigDecimal firstPosition; BigDecimal gridStep = getGridStep(tickSpace); @@ -189,11 +164,11 @@ public class AxisTick implements IChartPart, IHideable { firstPosition = MIN.subtract(MIN.remainder(gridStep)).add(gridStep); } - for (BigDecimal b = firstPosition; b.compareTo(axis.getMax()) <= 0; b = b.add(gridStep)) { + for (BigDecimal b = firstPosition; b.compareTo(axis.max) <= 0; b = b.add(gridStep)) { // System.out.println("b= " + b); tickLabels.add(format(b)); - int tickLabelPosition = (int) (margin + ((b.subtract(axis.getMin())).doubleValue() / (axis.getMax().subtract(axis.getMin())).doubleValue() * tickSpace)); + int tickLabelPosition = (int) (margin + ((b.subtract(axis.min)).doubleValue() / (axis.max.subtract(axis.min)).doubleValue() * tickSpace)); // System.out.println("tickLabelPosition= " + tickLabelPosition); tickLocations.add(tickLabelPosition); @@ -203,9 +178,9 @@ public class AxisTick implements IChartPart, IHideable { private BigDecimal getGridStep(int tickSpace) { - double length = Math.abs(axis.getMax().subtract(axis.getMin()).doubleValue()); + double length = Math.abs(axis.max.subtract(axis.min).doubleValue()); // System.out.println(axis.getMax()); - // System.out.println(axis.getMin()); + // System.out.println(axis.min); // System.out.println(length); double gridStepHint = length / tickSpace * DEFAULT_TICK_MARK_STEP_HINT; @@ -265,7 +240,7 @@ public class AxisTick implements IChartPart, IHideable { private String format(BigDecimal value) { - if (axis.getAxisType() == AxisType.NUMBER) { + if (axis.axisType == AxisType.NUMBER) { if (Math.abs(value.doubleValue()) < 9999 && Math.abs(value.doubleValue()) > .0001 || value.doubleValue() == 0) { return normalFormat.format(value.doubleValue()); } else { diff --git a/src/main/java/com/xeiam/xchart/AxisTickLabels.java b/src/main/java/com/xeiam/xchart/AxisTickLabels.java index 035bb3bbdb979bb8e64dc9febd6310986a9fe9fe..b223bf8b6c7716ea8cd955afafc170b2a0ee724b 100644 --- a/src/main/java/com/xeiam/xchart/AxisTickLabels.java +++ b/src/main/java/com/xeiam/xchart/AxisTickLabels.java @@ -28,6 +28,7 @@ import com.xeiam.xchart.interfaces.IChartPart; */ public class AxisTickLabels implements IChartPart { + /** parent */ private AxisTick axisTick; /** the font */ @@ -60,15 +61,15 @@ public class AxisTickLabels implements IChartPart { g.setColor(axisTick.axis.axisPair.chart.fontColor); - if (axisTick.axis.getDirection() == Axis.Direction.Y) { // Y-Axis + if (axisTick.axis.direction == Axis.Direction.Y) { // Y-Axis int xOffset = (int) (axisTick.axis.getAxisTitle().getBounds().getX() + axisTick.axis.getAxisTitle().getBounds().getWidth()); int yOffset = (int) (axisTick.axis.getPaintZone().getY()); int maxTickLabelWidth = 0; - for (int i = 0; i < axisTick.getTickLabels().size(); i++) { + for (int i = 0; i < axisTick.tickLabels.size(); i++) { - String tickLabel = axisTick.getTickLabels().get(i); - int tickLocation = axisTick.getTickLocations().get(i); + String tickLabel = axisTick.tickLabels.get(i); + int tickLocation = axisTick.tickLocations.get(i); FontRenderContext frc = g.getFontRenderContext(); // TextLayout layout = new TextLayout(tickLabel, font, new FontRenderContext(null, true, false)); @@ -91,10 +92,10 @@ public class AxisTickLabels implements IChartPart { int xOffset = (int) (axisTick.axis.getPaintZone().getX()); int yOffset = (int) (axisTick.axis.getAxisTitle().getBounds().getY()); int maxTickLabelHeight = 0; - for (int i = 0; i < axisTick.getTickLabels().size(); i++) { + for (int i = 0; i < axisTick.tickLabels.size(); i++) { - String tickLabel = axisTick.getTickLabels().get(i); - int tickLocation = axisTick.getTickLocations().get(i); + String tickLabel = axisTick.tickLabels.get(i); + int tickLocation = axisTick.tickLocations.get(i); FontRenderContext frc = g.getFontRenderContext(); TextLayout layout = new TextLayout(tickLabel, font, frc); diff --git a/src/main/java/com/xeiam/xchart/AxisTickMarks.java b/src/main/java/com/xeiam/xchart/AxisTickMarks.java index dba274d6da3f96ac279aee42c10328ef9f4aa117..9081bad4d683e057cc86357b695289c18e0e8606 100644 --- a/src/main/java/com/xeiam/xchart/AxisTickMarks.java +++ b/src/main/java/com/xeiam/xchart/AxisTickMarks.java @@ -27,14 +27,15 @@ import com.xeiam.xchart.interfaces.IChartPart; */ public class AxisTickMarks implements IChartPart { + /** the tick length */ + public static final int TICK_LENGTH = 3; + + /** parent */ private AxisTick axisTick; /** the line style */ private Stroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); - /** the tick length */ - public static final int TICK_LENGTH = 3; - /** the bounds */ private Rectangle bounds; @@ -44,7 +45,7 @@ public class AxisTickMarks implements IChartPart { * @param axis * @param axisTick */ - public AxisTickMarks(AxisTick axisTick) { + protected AxisTickMarks(AxisTick axisTick) { this.axisTick = axisTick; } @@ -62,15 +63,15 @@ public class AxisTickMarks implements IChartPart { g.setColor(axisTick.axis.axisPair.chart.bordersColor); - if (axisTick.axis.getDirection() == Axis.Direction.Y) { // Y-Axis + if (axisTick.axis.direction == Axis.Direction.Y) { // Y-Axis - int xOffset = (int) (axisTick.getAxisTickLabels().getBounds().getX() + axisTick.getAxisTickLabels().getBounds().getWidth() + AxisTick.AXIS_TICK_PADDING); + int xOffset = (int) (axisTick.axisTickLabels.getBounds().getX() + axisTick.axisTickLabels.getBounds().getWidth() + AxisTick.AXIS_TICK_PADDING); int yOffset = (int) (axisTick.axis.getPaintZone().getY()); // tick marks - for (int i = 0; i < axisTick.getTickLabels().size(); i++) { + for (int i = 0; i < axisTick.tickLabels.size(); i++) { - int tickLocation = axisTick.getTickLocations().get(i); + int tickLocation = axisTick.tickLocations.get(i); g.setColor(axisTick.axis.axisPair.chart.bordersColor); g.setStroke(stroke); @@ -89,12 +90,12 @@ public class AxisTickMarks implements IChartPart { } else { // X-Axis int xOffset = (int) (axisTick.axis.getPaintZone().getX()); - int yOffset = (int) (axisTick.getAxisTickLabels().getBounds().getY() - AxisTick.AXIS_TICK_PADDING); + int yOffset = (int) (axisTick.axisTickLabels.getBounds().getY() - AxisTick.AXIS_TICK_PADDING); // tick marks - for (int i = 0; i < axisTick.getTickLabels().size(); i++) { + for (int i = 0; i < axisTick.tickLabels.size(); i++) { - int tickLocation = axisTick.getTickLocations().get(i); + int tickLocation = axisTick.tickLocations.get(i); g.setColor(axisTick.axis.axisPair.chart.bordersColor); g.setStroke(stroke); diff --git a/src/main/java/com/xeiam/xchart/AxisTitle.java b/src/main/java/com/xeiam/xchart/AxisTitle.java index 147ee0135fcde712fb2c4af6d14459c3f91cc3bb..dd8c94aad36ce5f07d28e88287e2bac2e4403fce 100644 --- a/src/main/java/com/xeiam/xchart/AxisTitle.java +++ b/src/main/java/com/xeiam/xchart/AxisTitle.java @@ -31,7 +31,7 @@ public class AxisTitle implements IHideable { protected final static int AXIS_TITLE_PADDING = 10; - /** the chart */ + /** parent */ private Axis axis; /** the title text */ @@ -51,7 +51,7 @@ public class AxisTitle implements IHideable { * * @param axis the axis */ - public AxisTitle(Axis axis) { + protected AxisTitle(Axis axis) { this.axis = axis; font = new Font(Font.SANS_SERIF, Font.BOLD, 12); // default font @@ -96,7 +96,7 @@ public class AxisTitle implements IHideable { g.setColor(axis.axisPair.chart.fontColor); - if (axis.getDirection() == Axis.Direction.Y) { + if (axis.direction == Axis.Direction.Y) { if (isVisible) { FontRenderContext frc = g.getFontRenderContext(); diff --git a/src/main/java/com/xeiam/xchart/io/BitmapEncoder.java b/src/main/java/com/xeiam/xchart/BitmapEncoder.java similarity index 87% rename from src/main/java/com/xeiam/xchart/io/BitmapEncoder.java rename to src/main/java/com/xeiam/xchart/BitmapEncoder.java index 1d0f1e302fe19f45b4ba08c7dc0d26d1afca0539..cf043a264c22860e26eb29ff8b23002d0ec0d0b3 100644 --- a/src/main/java/com/xeiam/xchart/io/BitmapEncoder.java +++ b/src/main/java/com/xeiam/xchart/BitmapEncoder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.xeiam.xchart.io; +package com.xeiam.xchart; import java.awt.Graphics2D; import java.awt.image.BufferedImage; @@ -22,8 +22,6 @@ import java.io.OutputStream; import javax.imageio.ImageIO; -import com.xeiam.xchart.Chart; - /** * @author timmolter */ @@ -37,7 +35,7 @@ public class BitmapEncoder { */ public static void savePNG(Chart chart, String pFileName) throws Exception { - BufferedImage lBufferedImage = new BufferedImage(chart.getWidth(), chart.getHeight(), BufferedImage.TYPE_INT_RGB); + BufferedImage lBufferedImage = new BufferedImage(chart.width, chart.height, BufferedImage.TYPE_INT_RGB); Graphics2D lGraphics2D = lBufferedImage.createGraphics(); chart.paint(lGraphics2D); diff --git a/src/main/java/com/xeiam/xchart/Chart.java b/src/main/java/com/xeiam/xchart/Chart.java index 766e0ced0bfef35335f9c3fcfb801169ff899858..5242a307c39988c0f1b84157497e4abfd5779b30 100644 --- a/src/main/java/com/xeiam/xchart/Chart.java +++ b/src/main/java/com/xeiam/xchart/Chart.java @@ -33,18 +33,18 @@ import com.xeiam.xchart.series.SeriesMarker; */ public class Chart { - private int width; - private int height; + protected int width; + protected int height; private Color backgroundColor; protected Color bordersColor; protected Color fontColor; protected final static int CHART_PADDING = 10; - private ChartTitle chartTitle = new ChartTitle(this); - private ChartLegend chartLegend = new ChartLegend(this); - private AxisPair axisPair = new AxisPair(this); - private Plot plot = new Plot(this); + protected ChartTitle chartTitle = new ChartTitle(this); + protected ChartLegend chartLegend = new ChartLegend(this); + protected AxisPair axisPair = new AxisPair(this); + protected Plot plot = new Plot(this); /** * Constructor @@ -64,7 +64,7 @@ public class Chart { /** * @param g */ - public void paint(Graphics2D g, int width, int height) { + protected void paint(Graphics2D g, int width, int height) { this.width = width; this.height = height; @@ -75,10 +75,10 @@ public class Chart { /** * @param g */ - public void paint(Graphics2D g) { + protected void paint(Graphics2D g) { // Sanity check - if (axisPair.getSeriesMap().isEmpty()) { + if (axisPair.seriesMap.isEmpty()) { throw new RuntimeException("No series defined for Chart!!!"); } @@ -100,38 +100,6 @@ public class Chart { } - // GETTERS & SETTERS - - public int getWidth() { - - return width; - } - - public int getHeight() { - - return height; - } - - protected ChartTitle getTitle() { - - return chartTitle; - } - - protected ChartLegend getLegend() { - - return chartLegend; - } - - protected AxisPair getAxisPair() { - - return axisPair; - } - - protected Plot getPlot() { - - return plot; - } - // PUBLIC SETTERS /** @@ -220,12 +188,12 @@ public class Chart { public void setXAxisTitle(String title) { - this.axisPair.getXAxis().setAxisTitle(title); + this.axisPair.xAxis.setAxisTitle(title); } public void setYAxisTitle(String title) { - this.axisPair.getYAxis().setAxisTitle(title); + this.axisPair.yAxis.setAxisTitle(title); } // ChartPart visibility //////////////////////////////// @@ -237,18 +205,18 @@ public class Chart { public void setAxisTitlesVisible(boolean isVisible) { - this.axisPair.getXAxis().getAxisTitle().setVisible(isVisible); - this.axisPair.getYAxis().getAxisTitle().setVisible(isVisible); + this.axisPair.xAxis.getAxisTitle().setVisible(isVisible); + this.axisPair.yAxis.getAxisTitle().setVisible(isVisible); } public void setXAxisTitleVisible(boolean isVisible) { - this.axisPair.getXAxis().getAxisTitle().setVisible(isVisible); + this.axisPair.xAxis.getAxisTitle().setVisible(isVisible); } public void setYAxisTitleVisible(boolean isVisible) { - this.axisPair.getYAxis().getAxisTitle().setVisible(isVisible); + this.axisPair.yAxis.getAxisTitle().setVisible(isVisible); } public void setChartLegendVisible(boolean isVisible) { @@ -258,23 +226,23 @@ public class Chart { public void setAxisTicksVisible(boolean isVisible) { - this.axisPair.getXAxis().axisTick.setVisible(isVisible); - this.axisPair.getYAxis().axisTick.setVisible(isVisible); + this.axisPair.xAxis.axisTick.setVisible(isVisible); + this.axisPair.yAxis.axisTick.setVisible(isVisible); } public void setXAxisTicksVisible(boolean isVisible) { - this.axisPair.getXAxis().axisTick.setVisible(isVisible); + this.axisPair.xAxis.axisTick.setVisible(isVisible); } public void setYAxisTicksVisible(boolean isVisible) { - this.axisPair.getYAxis().axisTick.setVisible(isVisible); + this.axisPair.yAxis.axisTick.setVisible(isVisible); } public void setChartGridlinesVisible(boolean isVisible) { - this.plot.getPlotSurface().setVisible(isVisible); + this.plot.plotSurface.setVisible(isVisible); } public void setChartBackgroundColor(Color color) { @@ -284,17 +252,17 @@ public class Chart { public void setChartForegroundColor(Color color) { - this.plot.getPlotSurface().setForegroundColor(color); + this.plot.plotSurface.setForegroundColor(color); } public void setChartGridLinesColor(Color color) { - this.plot.getPlotSurface().setGridLinesColor(color); + this.plot.plotSurface.setGridLinesColor(color); } public void setChartLegendBackgroundColor(Color color) { - this.chartLegend.setBackgroundColor(color); + this.chartLegend.backgroundColor = color; } public void setChartBordersColor(Color color) { diff --git a/src/main/java/com/xeiam/xchart/ChartLegend.java b/src/main/java/com/xeiam/xchart/ChartLegend.java index 40d9ea57c195a48bfe3320d33423d64fa6b30025..64a42cc719df7874c1105361edf63defcf3139dc 100644 --- a/src/main/java/com/xeiam/xchart/ChartLegend.java +++ b/src/main/java/com/xeiam/xchart/ChartLegend.java @@ -34,7 +34,7 @@ public class ChartLegend implements IHideable { private final int LEGEND_PADDING = 10; - /** the chart */ + /** parent */ private Chart chart; /** the visibility state of legend */ @@ -44,7 +44,7 @@ public class ChartLegend implements IHideable { protected Font font; /** the background color */ - private Color backgroundColor; + protected Color backgroundColor; /** the bounds */ private Rectangle bounds; @@ -72,7 +72,7 @@ public class ChartLegend implements IHideable { if (isVisible) { - Map<Integer, Series> seriesMap = chart.getAxisPair().getSeriesMap(); + Map<Integer, Series> seriesMap = chart.axisPair.seriesMap; // determine legend text content max width int legendTextContentMaxWidth = 0; @@ -102,8 +102,8 @@ public class ChartLegend implements IHideable { // Draw Legend Box int legendBoxWidth = legendContentWidth + 2 * LEGEND_PADDING; int legendBoxHeight = legendContentHeight + 2 * LEGEND_PADDING; - int xOffset = chart.getWidth() - legendBoxWidth - Chart.CHART_PADDING; - int yOffset = (int) ((chart.getHeight() - legendBoxHeight) / 2.0 + chart.getTitle().getBounds().getY() + chart.getTitle().getBounds().getHeight()); + int xOffset = chart.width - legendBoxWidth - Chart.CHART_PADDING; + int yOffset = (int) ((chart.height - legendBoxHeight) / 2.0 + chart.chartTitle.getBounds().getY() + chart.chartTitle.getBounds().getHeight()); g.setColor(chart.bordersColor); g.drawRect(xOffset, yOffset, legendBoxWidth, legendBoxHeight); @@ -148,12 +148,4 @@ public class ChartLegend implements IHideable { return bounds; } - /** - * @param backgroundColor the backgroundColor to set - */ - public void setBackgroundColor(Color backgroundColor) { - - this.backgroundColor = backgroundColor; - } - } diff --git a/src/main/java/com/xeiam/xchart/ChartTitle.java b/src/main/java/com/xeiam/xchart/ChartTitle.java index c66841f846a852a1aea4e220fc06975fe5fde208..478251acf931ccfd34f3474d085cb440a0870cc3 100644 --- a/src/main/java/com/xeiam/xchart/ChartTitle.java +++ b/src/main/java/com/xeiam/xchart/ChartTitle.java @@ -28,8 +28,8 @@ import com.xeiam.xchart.interfaces.IHideable; */ public class ChartTitle implements IHideable { - /** the chart */ - protected Chart chart; + /** parent */ + private Chart chart; /** the title text */ protected String text = ""; // default to "" @@ -52,7 +52,7 @@ public class ChartTitle implements IHideable { font = new Font(Font.SANS_SERIF, Font.BOLD, 14); // default font } - public void setText(String text) { + protected void setText(String text) { if (text.trim().equalsIgnoreCase("")) { this.isVisible = false; @@ -78,7 +78,7 @@ public class ChartTitle implements IHideable { FontRenderContext frc = g.getFontRenderContext(); TextLayout textLayout = new TextLayout(text, font, frc); Rectangle rectangle = textLayout.getPixelBounds(null, 0, 0); - int xOffset = (int) ((chart.getWidth() - rectangle.getWidth()) / 2.0); + int xOffset = (int) ((chart.width - rectangle.getWidth()) / 2.0); int yOffset = (int) ((isVisible ? (Chart.CHART_PADDING - rectangle.getY()) : 0)); bounds = new Rectangle(xOffset, yOffset + (isVisible ? (int) rectangle.getY() : 0), (int) rectangle.getWidth(), (int) (isVisible ? rectangle.getHeight() : 0)); diff --git a/src/main/java/com/xeiam/xchart/Plot.java b/src/main/java/com/xeiam/xchart/Plot.java index ec43db663e3e10680640c926a0e802ab9d5812dc..8ac0b03a68ef2d7f7becbd467c80e98f7e753140 100644 --- a/src/main/java/com/xeiam/xchart/Plot.java +++ b/src/main/java/com/xeiam/xchart/Plot.java @@ -25,22 +25,23 @@ import com.xeiam.xchart.interfaces.IChartPart; */ public class Plot implements IChartPart { + /** parent */ protected Chart chart; - private PlotSurface plotSurface; + protected PlotSurface plotSurface; - private PlotContent plotContent; + protected PlotContent plotContent; public static final int PLOT_PADDING = 3; /** the bounds */ private Rectangle bounds; - public Plot(Chart chart) { + protected Plot(Chart chart) { this.chart = chart; - this.plotSurface = new PlotSurface(chart, this); - this.plotContent = new PlotContent(chart, this); + this.plotSurface = new PlotSurface(this); + this.plotContent = new PlotContent(this); } @Override @@ -55,10 +56,10 @@ public class Plot implements IChartPart { bounds = new Rectangle(); // calculate bounds - int xOffset = (int) (chart.getAxisPair().getYAxis().getBounds().getX() + chart.getAxisPair().getYAxis().getBounds().getWidth() + (chart.getAxisPair().getYAxis().axisTick.isVisible ? (Plot.PLOT_PADDING + 1) : 0)); - int yOffset = (int) (chart.getAxisPair().getYAxis().getBounds().getY()); - int width = (int) chart.getAxisPair().getXAxis().getBounds().getWidth(); - int height = (int) chart.getAxisPair().getYAxis().getBounds().getHeight(); + int xOffset = (int) (chart.axisPair.yAxis.getBounds().getX() + chart.axisPair.yAxis.getBounds().getWidth() + (chart.axisPair.yAxis.axisTick.isVisible ? (Plot.PLOT_PADDING + 1) : 0)); + int yOffset = (int) (chart.axisPair.yAxis.getBounds().getY()); + int width = (int) chart.axisPair.xAxis.getBounds().getWidth(); + int height = (int) chart.axisPair.yAxis.getBounds().getHeight(); bounds = new Rectangle(xOffset, yOffset, width, height); // g.setColor(Color.green); // g.draw(bounds); @@ -68,12 +69,4 @@ public class Plot implements IChartPart { } - /** - * @return the plotSurface - */ - public PlotSurface getPlotSurface() { - - return plotSurface; - } - } diff --git a/src/main/java/com/xeiam/xchart/PlotContent.java b/src/main/java/com/xeiam/xchart/PlotContent.java index 04d27170d48ea0672e08d6bdd5fa62b1b6a220bf..2ccb8c1ccc166248060bef0cd1e87a683148376a 100644 --- a/src/main/java/com/xeiam/xchart/PlotContent.java +++ b/src/main/java/com/xeiam/xchart/PlotContent.java @@ -33,13 +33,16 @@ import com.xeiam.xchart.series.SeriesLineStyle; */ public class PlotContent implements IChartPart { - private Chart chart; - + /** parent */ private Plot plot; - public PlotContent(Chart chart, Plot plot) { + /** + * Constructor + * + * @param plot + */ + protected PlotContent(Plot plot) { - this.chart = chart; this.plot = plot; } @@ -54,7 +57,7 @@ public class PlotContent implements IChartPart { Rectangle bounds = plot.getBounds(); - Map<Integer, Series> seriesMap = chart.getAxisPair().getSeriesMap(); + Map<Integer, Series> seriesMap = plot.chart.axisPair.seriesMap; for (Integer seriesId : seriesMap.keySet()) { Series series = seriesMap.get(seriesId); @@ -69,11 +72,11 @@ public class PlotContent implements IChartPart { // data points Collection<?> xData = series.getxData(); - BigDecimal xMin = chart.getAxisPair().getXAxis().getMin(); - BigDecimal xMax = chart.getAxisPair().getXAxis().getMax(); + BigDecimal xMin = plot.chart.axisPair.xAxis.min; + BigDecimal xMax = plot.chart.axisPair.xAxis.max; Collection<Number> yData = series.getyData(); - BigDecimal yMin = chart.getAxisPair().getYAxis().getMin(); - BigDecimal yMax = chart.getAxisPair().getYAxis().getMax(); + BigDecimal yMin = plot.chart.axisPair.yAxis.min; + BigDecimal yMax = plot.chart.axisPair.yAxis.max; Collection<Number> errorBars = series.getErrorBars(); int previousX = Integer.MIN_VALUE; @@ -88,10 +91,10 @@ public class PlotContent implements IChartPart { while (xItr.hasNext()) { BigDecimal x = null; - if (chart.getAxisPair().getXAxis().getAxisType() == AxisType.NUMBER) { + if (plot.chart.axisPair.xAxis.axisType == AxisType.NUMBER) { x = new BigDecimal(((Number) xItr.next()).doubleValue()); } - if (chart.getAxisPair().getXAxis().getAxisType() == AxisType.DATE) { + if (plot.chart.axisPair.xAxis.axisType == AxisType.DATE) { x = new BigDecimal(((Date) xItr.next()).getTime()); // System.out.println(x); } diff --git a/src/main/java/com/xeiam/xchart/PlotSurface.java b/src/main/java/com/xeiam/xchart/PlotSurface.java index a9d1388fcac6b09cc80da6bbd07abea2ad71d5ae..e3dec555d8606ea04253e118498f1a5028d680f3 100644 --- a/src/main/java/com/xeiam/xchart/PlotSurface.java +++ b/src/main/java/com/xeiam/xchart/PlotSurface.java @@ -29,8 +29,7 @@ import com.xeiam.xchart.interfaces.IHideable; */ public class PlotSurface implements IChartPart, IHideable { - private Chart chart; - + /** parent */ private Plot plot; /** the gridLines Color */ @@ -40,7 +39,7 @@ public class PlotSurface implements IChartPart, IHideable { private Color foregroundColor; /** the line style */ - private BasicStroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10.0f, new float[] { 3.0f, 3.0f }, 0.0f); + private BasicStroke stroke; /** the visibility state of PlotSurface */ protected boolean isVisible = true; // default to true @@ -51,12 +50,12 @@ public class PlotSurface implements IChartPart, IHideable { * @param chart * @param plot */ - public PlotSurface(Chart chart, Plot plot) { + protected PlotSurface(Plot plot) { - this.chart = chart; this.plot = plot; gridLinesColor = ChartColor.getAWTColor(ChartColor.GREY); // default gridLines color foregroundColor = ChartColor.getAWTColor(ChartColor.LIGHT_GREY); // default foreground Color color + stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10.0f, new float[] { 3.0f, 3.0f }, 0.0f); } @Override @@ -75,13 +74,13 @@ public class PlotSurface implements IChartPart, IHideable { g.setColor(foregroundColor); g.fill(backgroundRectangle); Rectangle borderRectangle = new Rectangle((int) bounds.getX() - 1, (int) bounds.getY(), (int) (bounds.getWidth()), (int) bounds.getHeight()); - g.setColor(chart.bordersColor); + g.setColor(plot.chart.bordersColor); g.draw(borderRectangle); // paint grid lines if (isVisible) { // horizontal - List<Integer> yAxisTickLocations = chart.getAxisPair().getYAxis().axisTick.getTickLocations(); + List<Integer> yAxisTickLocations = plot.chart.axisPair.yAxis.axisTick.tickLocations; for (int i = 0; i < yAxisTickLocations.size(); i++) { int tickLocation = yAxisTickLocations.get(i); @@ -93,7 +92,7 @@ public class PlotSurface implements IChartPart, IHideable { } // vertical - List<Integer> xAxisTickLocations = chart.getAxisPair().getXAxis().axisTick.getTickLocations(); + List<Integer> xAxisTickLocations = plot.chart.axisPair.xAxis.axisTick.tickLocations; for (int i = 0; i < xAxisTickLocations.size(); i++) { int tickLocation = xAxisTickLocations.get(i); diff --git a/src/main/java/com/xeiam/xchart/io/ServletEncoder.java b/src/main/java/com/xeiam/xchart/ServletEncoder.java similarity index 86% rename from src/main/java/com/xeiam/xchart/io/ServletEncoder.java rename to src/main/java/com/xeiam/xchart/ServletEncoder.java index 0dc8cf10b498bf2b7bc4aa92a9b73d3604397962..fd2c4b662d2ae8b92f3179c010a9779f6be3fe72 100644 --- a/src/main/java/com/xeiam/xchart/io/ServletEncoder.java +++ b/src/main/java/com/xeiam/xchart/ServletEncoder.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.xeiam.xchart.io; +package com.xeiam.xchart; import java.awt.Graphics2D; import java.awt.image.BufferedImage; @@ -21,8 +21,6 @@ import java.awt.image.BufferedImage; import javax.imageio.ImageIO; import javax.servlet.ServletOutputStream; -import com.xeiam.xchart.Chart; - /** * @author timmolter */ @@ -36,7 +34,7 @@ public class ServletEncoder { */ public static void streamPNG(ServletOutputStream out, Chart chart) throws Exception { - BufferedImage lBufferedImage = new BufferedImage(chart.getWidth(), chart.getHeight(), BufferedImage.TYPE_INT_RGB); + BufferedImage lBufferedImage = new BufferedImage(chart.width, chart.height, BufferedImage.TYPE_INT_RGB); Graphics2D lGraphics2D = lBufferedImage.createGraphics(); chart.paint(lGraphics2D); diff --git a/src/main/java/com/xeiam/xchart/swing/SwingWrapper.java b/src/main/java/com/xeiam/xchart/SwingWrapper.java similarity index 98% rename from src/main/java/com/xeiam/xchart/swing/SwingWrapper.java rename to src/main/java/com/xeiam/xchart/SwingWrapper.java index 0ab5fba05d4af8fcb9c96fb57b209f7e72ab2b08..f2d6a3831775a5c1087d41cfc9237fbf0eba8790 100644 --- a/src/main/java/com/xeiam/xchart/swing/SwingWrapper.java +++ b/src/main/java/com/xeiam/xchart/SwingWrapper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.xeiam.xchart.swing; +package com.xeiam.xchart; import java.awt.GridLayout; import java.util.ArrayList; @@ -22,7 +22,6 @@ import java.util.List; import javax.swing.JFrame; import javax.swing.JPanel; -import com.xeiam.xchart.Chart; /** * @author timmolter diff --git a/src/main/java/com/xeiam/xchart/swing/XChartJPanel.java b/src/main/java/com/xeiam/xchart/XChartJPanel.java similarity index 89% rename from src/main/java/com/xeiam/xchart/swing/XChartJPanel.java rename to src/main/java/com/xeiam/xchart/XChartJPanel.java index 2c2beb8aa71acec7ea796180a8f86828f2c3da4c..bb8e69ccc2eba887a1fb06a69801fe9bd7eea0f2 100644 --- a/src/main/java/com/xeiam/xchart/swing/XChartJPanel.java +++ b/src/main/java/com/xeiam/xchart/XChartJPanel.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.xeiam.xchart.swing; +package com.xeiam.xchart; import java.awt.Dimension; import java.awt.Graphics; @@ -21,8 +21,6 @@ import java.awt.Graphics2D; import javax.swing.JPanel; -import com.xeiam.xchart.Chart; - /** * @author timmolter * @create Sep 9, 2012 @@ -48,6 +46,6 @@ public class XChartJPanel extends JPanel { @Override public Dimension getPreferredSize() { - return new Dimension(chart.getWidth(), chart.getHeight()); + return new Dimension(chart.width, chart.height); } } diff --git a/src/test/java/com/xeiam/xchart/example/ChartServletExample.java b/src/test/java/com/xeiam/xchart/example/ChartServletExample.java index 9d87d3f5fc40a06c3cf504d5a6fffd8268548bf4..ac4717ecd6a220b79d322150ea8b7e92e913a705 100644 --- a/src/test/java/com/xeiam/xchart/example/ChartServletExample.java +++ b/src/test/java/com/xeiam/xchart/example/ChartServletExample.java @@ -27,7 +27,7 @@ import javax.servlet.http.HttpServletResponse; import com.xeiam.xchart.Chart; import com.xeiam.xchart.QuickChart; -import com.xeiam.xchart.io.ServletEncoder; +import com.xeiam.xchart.ServletEncoder; /** * Generates, stores, and serves charts diff --git a/src/test/java/com/xeiam/xchart/example/Example1.java b/src/test/java/com/xeiam/xchart/example/Example1.java index 18c42fc03efe68e7d10e08a952e095d2ac2c5dd8..7615a75069faddd112ff4584804ae5a96d49e170 100644 --- a/src/test/java/com/xeiam/xchart/example/Example1.java +++ b/src/test/java/com/xeiam/xchart/example/Example1.java @@ -18,8 +18,8 @@ package com.xeiam.xchart.example; import java.util.Arrays; import java.util.Collection; +import com.xeiam.xchart.BitmapEncoder; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.io.BitmapEncoder; /** * Creates a simple charts and saves it as a PNG image file. diff --git a/src/test/java/com/xeiam/xchart/example/Example2.java b/src/test/java/com/xeiam/xchart/example/Example2.java index ea24993bf8083ae792189493926ca8e88215810c..1341b1656d839c5b4872d6445c41889ea45fca6c 100644 --- a/src/test/java/com/xeiam/xchart/example/Example2.java +++ b/src/test/java/com/xeiam/xchart/example/Example2.java @@ -19,11 +19,11 @@ import java.util.ArrayList; import java.util.Collection; import com.xeiam.xchart.Chart; +import com.xeiam.xchart.SwingWrapper; import com.xeiam.xchart.series.Series; import com.xeiam.xchart.series.SeriesColor; import com.xeiam.xchart.series.SeriesLineStyle; import com.xeiam.xchart.series.SeriesMarker; -import com.xeiam.xchart.swing.SwingWrapper; /** * Embed a Chart in a simple Swing application diff --git a/src/test/java/com/xeiam/xchart/example/Example3.java b/src/test/java/com/xeiam/xchart/example/Example3.java index 0ae74838b478b2edd528ac26e6f56ce0c26534c9..a63b97ed0f67e0a7402e9c02e68b6a1a8cc7b8ce 100644 --- a/src/test/java/com/xeiam/xchart/example/Example3.java +++ b/src/test/java/com/xeiam/xchart/example/Example3.java @@ -19,7 +19,7 @@ import java.util.ArrayList; import java.util.Collection; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.swing.SwingWrapper; +import com.xeiam.xchart.SwingWrapper; /** * Create multiple curves on one chart diff --git a/src/test/java/com/xeiam/xchart/example/Example4.java b/src/test/java/com/xeiam/xchart/example/Example4.java index c519bacc09b582bc76e37fd62507bb84389b2cb9..d4d2f400bff2627112550768f06ce218083343c4 100644 --- a/src/test/java/com/xeiam/xchart/example/Example4.java +++ b/src/test/java/com/xeiam/xchart/example/Example4.java @@ -20,7 +20,7 @@ import java.util.List; import com.xeiam.xchart.Chart; import com.xeiam.xchart.QuickChart; -import com.xeiam.xchart.swing.SwingWrapper; +import com.xeiam.xchart.SwingWrapper; /** * Create a chart matrix diff --git a/src/test/java/com/xeiam/xchart/example/Example5.java b/src/test/java/com/xeiam/xchart/example/Example5.java index bb765cd95e6df305e95965317f59af983b806d25..bf0c5ce82bef18b3d708a84815e12d5637f392f6 100644 --- a/src/test/java/com/xeiam/xchart/example/Example5.java +++ b/src/test/java/com/xeiam/xchart/example/Example5.java @@ -16,7 +16,7 @@ package com.xeiam.xchart.example; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.swing.SwingWrapper; +import com.xeiam.xchart.SwingWrapper; /** * Plot vertical and horizontal lines diff --git a/src/test/java/com/xeiam/xchart/example/Example6.java b/src/test/java/com/xeiam/xchart/example/Example6.java index a283dc6491a2159d8d59ee318a24d91889540292..05a2eb52107bc3f205417544b6a5ad18325a43bd 100644 --- a/src/test/java/com/xeiam/xchart/example/Example6.java +++ b/src/test/java/com/xeiam/xchart/example/Example6.java @@ -16,7 +16,7 @@ package com.xeiam.xchart.example; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.swing.SwingWrapper; +import com.xeiam.xchart.SwingWrapper; /** * Create chart with single point diff --git a/src/test/java/com/xeiam/xchart/example/Example7.java b/src/test/java/com/xeiam/xchart/example/Example7.java index eaf20a172d427bd7eb03ebf63e6b903a18e6b2ea..1377b4018de22abb39e3dd37ff40748cf30f1d19 100644 --- a/src/test/java/com/xeiam/xchart/example/Example7.java +++ b/src/test/java/com/xeiam/xchart/example/Example7.java @@ -19,7 +19,7 @@ import java.util.Arrays; import java.util.Collection; import com.xeiam.xchart.Chart; -import com.xeiam.xchart.swing.SwingWrapper; +import com.xeiam.xchart.SwingWrapper; /** * Creates a simple charts using Longs as inputs diff --git a/src/test/java/com/xeiam/xchart/example/Example8.java b/src/test/java/com/xeiam/xchart/example/Example8.java index 398de4cb2bf525869e688cdaaaa866e631638317..72f8b15b49668d54610e9ca43e38223c06aa86e3 100644 --- a/src/test/java/com/xeiam/xchart/example/Example8.java +++ b/src/test/java/com/xeiam/xchart/example/Example8.java @@ -19,11 +19,11 @@ import java.util.ArrayList; import java.util.Collection; import com.xeiam.xchart.Chart; +import com.xeiam.xchart.SwingWrapper; import com.xeiam.xchart.series.Series; import com.xeiam.xchart.series.SeriesColor; import com.xeiam.xchart.series.SeriesLineStyle; import com.xeiam.xchart.series.SeriesMarker; -import com.xeiam.xchart.swing.SwingWrapper; /** * Create a Chart with error bars diff --git a/src/test/java/com/xeiam/xchart/example/Example9.java b/src/test/java/com/xeiam/xchart/example/Example9.java index 92a3b99c4d8fcef52bb7b206797eac128e69853f..a0a2f205336abd00cc3a3137eb60b6e7482cc398 100644 --- a/src/test/java/com/xeiam/xchart/example/Example9.java +++ b/src/test/java/com/xeiam/xchart/example/Example9.java @@ -26,11 +26,11 @@ import java.util.Date; import com.xeiam.xchart.Chart; import com.xeiam.xchart.ChartColor; +import com.xeiam.xchart.SwingWrapper; import com.xeiam.xchart.series.Series; import com.xeiam.xchart.series.SeriesColor; import com.xeiam.xchart.series.SeriesLineStyle; import com.xeiam.xchart.series.SeriesMarker; -import com.xeiam.xchart.swing.SwingWrapper; /** * Create a chart with a Date x-axis and extensive chart customization