From: <mu...@us...> - 2008-07-25 13:49:49
|
Revision: 1340 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1340&view=rev Author: mungady Date: 2008-07-25 13:49:44 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Synchronised with 1.0.x branch. Modified Paths: -------------- trunk/source/org/jfree/chart/plot/XYPlot.java Modified: trunk/source/org/jfree/chart/plot/XYPlot.java =================================================================== --- trunk/source/org/jfree/chart/plot/XYPlot.java 2008-07-25 13:41:10 UTC (rev 1339) +++ trunk/source/org/jfree/chart/plot/XYPlot.java 2008-07-25 13:49:44 UTC (rev 1340) @@ -207,6 +207,7 @@ * for the domain axes (DG); * 09-Jul-2008 : Added renderer state notification when series pass begins * and ends - see patch 1997549 by Ulrich Voigt (DG); + * 25-Jul-2008 : Fixed NullPointerException for plots with no axes (DG); * */ @@ -2172,7 +2173,7 @@ * @see #addRangeMarker(int, Marker, Layer) */ public void addDomainMarker(int index, Marker marker, Layer layer) { - addDomainMarker(index, marker, layer, true); + addDomainMarker(index, marker, layer, true); } /** @@ -3046,10 +3047,16 @@ boolean somethingToDraw = false; ValueAxis xAxis = getDomainAxis(); + if (xAxis == null) { // we can't draw quadrants without a valid x-axis + return; + } double x = xAxis.getRange().constrain(this.quadrantOrigin.getX()); double xx = xAxis.valueToJava2D(x, area, getDomainAxisEdge()); ValueAxis yAxis = getRangeAxis(); + if (yAxis == null) { // we can't draw quadrants without a valid y-axis + return; + } double y = yAxis.getRange().constrain(this.quadrantOrigin.getY()); double yy = yAxis.valueToJava2D(y, area, getRangeAxisEdge()); @@ -3071,8 +3078,7 @@ if (this.orientation == PlotOrientation.HORIZONTAL) { r[0] = new Rectangle2D.Double(Math.min(yymax, yy), Math.min(xxmin, xx), Math.abs(yy - yymax), - Math.abs(xx - xxmin) - ); + Math.abs(xx - xxmin)); } else { // PlotOrientation.VERTICAL r[0] = new Rectangle2D.Double(Math.min(xxmin, xx), @@ -3323,6 +3329,9 @@ foundData = true; ValueAxis xAxis = getDomainAxisForDataset(index); ValueAxis yAxis = getRangeAxisForDataset(index); + if (xAxis == null || yAxis == null) { + return foundData; // can't render anything without axes + } XYItemRenderer renderer = getRenderer(index); if (renderer == null) { renderer = getRenderer(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |