diff --git a/dist/xchart-1.0.0.jar b/dist/xchart-1.0.0.jar index f63ad44f378aab088356e5bda79581b9338f6465..4662cc8f1bef5c27cfcfd1d349ad0901138c85da 100644 Binary files a/dist/xchart-1.0.0.jar and b/dist/xchart-1.0.0.jar differ diff --git a/src/com/xeiam/xcharts/AxisTick.java b/src/com/xeiam/xcharts/AxisTick.java index 4d0a14e292b7d52220ba13db411da3494965086b..6a09f1931f83f9424531d8eea30008bca175911a 100644 --- a/src/com/xeiam/xcharts/AxisTick.java +++ b/src/com/xeiam/xcharts/AxisTick.java @@ -131,10 +131,10 @@ public class AxisTick implements IChartPart { */ private void determineAxisTick() { - System.out.println("workingSpace= " + workingSpace); + // System.out.println("workingSpace= " + workingSpace); int tickSpace = AxisPair.getTickSpace(workingSpace); - System.out.println("tickSpace= " + tickSpace); + // System.out.println("tickSpace= " + tickSpace); int margin = AxisPair.getMargin(workingSpace, tickSpace); diff --git a/src/com/xeiam/xcharts/PlotContent.java b/src/com/xeiam/xcharts/PlotContent.java index 3e45d23065c32f5365732bef7dc1e0225ca83c32..6f6456046c8aab628cda260757c091a79125b898 100644 --- a/src/com/xeiam/xcharts/PlotContent.java +++ b/src/com/xeiam/xcharts/PlotContent.java @@ -72,45 +72,48 @@ public class PlotContent implements IChartPart { for (int i = 0; i < xData.length; i++) { - if (Double.isInfinite(xData[i]) || Double.isNaN(xData[i])) { - throw new RuntimeException("Infinite or NaN values in xAxis Data not allowed!!!"); - } - - if (Double.isInfinite(yData[i]) || Double.isNaN(yData[i])) { - throw new RuntimeException("Infinite or NaN values in yAxis Data not allowed!!!"); - } - - int xTransform = (int) (xLeftMargin + ((xData[i] - xMin) / (xMax - xMin) * xTickSpace)); - int yTransform = (int) (bounds.getHeight() - (yTopMargin + (yData[i] - yMin) / (yMax - yMin) * yTickSpace)); - - // a check if all y data are the exact same values - if (Math.abs(xMax - xMin) / 5 == 0.0) { - xTransform = (int) (bounds.getWidth() / 2.0); - } - - // a check if all y data are the exact same values - if (Math.abs(yMax - yMin) / 5 == 0.0) { - yTransform = (int) (bounds.getHeight() / 2.0); - } + // if (Double.isInfinite(xData[i]) || Double.isNaN(xData[i])) { + // throw new RuntimeException("Infinite or NaN values in xAxis Data not allowed!!!"); + // } + // + // if (Double.isInfinite(yData[i]) || Double.isNaN(yData[i])) { + // throw new RuntimeException("Infinite or NaN values in yAxis Data not allowed!!!"); + // } + + if (!Double.isInfinite(xData[i]) && !Double.isNaN(xData[i]) && !Double.isInfinite(yData[i]) && !Double.isNaN(yData[i])) { + + int xTransform = (int) (xLeftMargin + ((xData[i] - xMin) / (xMax - xMin) * xTickSpace)); + int yTransform = (int) (bounds.getHeight() - (yTopMargin + (yData[i] - yMin) / (yMax - yMin) * yTickSpace)); + + // a check if all y data are the exact same values + if (Math.abs(xMax - xMin) / 5 == 0.0) { + xTransform = (int) (bounds.getWidth() / 2.0); + } - int xOffset = (int) (bounds.getX() + xTransform - 1); - int yOffset = (int) (bounds.getY() + yTransform); + // a check if all y data are the exact same values + if (Math.abs(yMax - yMin) / 5 == 0.0) { + yTransform = (int) (bounds.getHeight() / 2.0); + } - // paint line - if (series.getLineStyle() != null) { - if (previousX != Integer.MIN_VALUE && previousY != Integer.MIN_VALUE) { - g.setColor(series.getLineColor()); - g.setStroke(series.getLineStyle()); - g.drawLine(previousX, previousY, xOffset, yOffset); + int xOffset = (int) (bounds.getX() + xTransform - 1); + int yOffset = (int) (bounds.getY() + yTransform); + + // paint line + if (series.getLineStyle() != null) { + if (previousX != Integer.MIN_VALUE && previousY != Integer.MIN_VALUE) { + g.setColor(series.getLineColor()); + g.setStroke(series.getLineStyle()); + g.drawLine(previousX, previousY, xOffset, yOffset); + } + previousX = xOffset; + previousY = yOffset; } - previousX = xOffset; - previousY = yOffset; - } - // paint marker - if (series.getMarker() != null) { - g.setColor(series.getMarkerColor()); - series.getMarker().paint(g, xOffset, yOffset); + // paint marker + if (series.getMarker() != null) { + g.setColor(series.getMarkerColor()); + series.getMarker().paint(g, xOffset, yOffset); + } } } }