From: <mu...@us...> - 2008-11-24 09:48:10
|
Revision: 1697 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1697&view=rev Author: mungady Date: 2008-11-24 09:48:01 +0000 (Mon, 24 Nov 2008) Log Message: ----------- 2008-11-24 David Gilbert <dav...@ob...> Bug 1955483: * source/org/jfree/data/xy/XYSeries.java (addOrUpdate): Check early for duplicates allowed, * tests/org/jfree/data/xy/junit/XYSeriesTests.java (testBug1955483): New test. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/NEWS branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/XYSeries.java branches/jfreechart-1.0.x-branch/tests/org/jfree/data/xy/junit/XYSeriesTests.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2008-11-24 09:19:36 UTC (rev 1696) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2008-11-24 09:48:01 UTC (rev 1697) @@ -1,3 +1,11 @@ +2008-11-24 David Gilbert <dav...@ob...> + + Bug 1955483: + * source/org/jfree/data/xy/XYSeries.java + (addOrUpdate): Check early for duplicates allowed, + * tests/org/jfree/data/xy/junit/XYSeriesTests.java + (testBug1955483): New test. + 2008-11-18 David Gilbert <dav...@ob...> Bug 2216511: Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2008-11-24 09:19:36 UTC (rev 1696) +++ branches/jfreechart-1.0.x-branch/NEWS 2008-11-24 09:48:01 UTC (rev 1697) @@ -7,7 +7,8 @@ 2221495 : XYLineAnnotation with dashed stroke; 2216511 : SWTBarChartDemo1 throws RuntimeException; 2121818 : Label link lines for very thin RingPlot; -2113627 : XYStepRenderer item labels. +2113627 : XYStepRenderer item labels; +1955483 : XYSeries.addOrUpdate() problem. Also fixed StackedXYBarRenderer which was ignoring the shadowsVisible attribute. Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/XYSeries.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/XYSeries.java 2008-11-24 09:19:36 UTC (rev 1696) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/xy/XYSeries.java 2008-11-24 09:48:01 UTC (rev 1697) @@ -70,6 +70,7 @@ * 22-Nov-2007 : Reimplemented clone() (DG); * 01-May-2008 : Fixed bug 1955483 in addOrUpdate() method, thanks to * Ted Schwartz (DG); + * 24-Nov-2008 : Further fix for 1955483 (DG); * */ @@ -295,14 +296,18 @@ } /** - * Adds new data to the series and sends a {@link SeriesChangeEvent} to - * all registered listeners. + * Adds a new data item to the series (in the correct position if the + * <code>autoSort</code> flag is set for the series) and sends a + * {@link SeriesChangeEvent} to all registered listeners. * <P> * Throws an exception if the x-value is a duplicate AND the * allowDuplicateXValues flag is false. * * @param x the x-value (<code>null</code> not permitted). * @param y the y-value (<code>null</code> permitted). + * + * @throws SeriesException if the x-value is a duplicate and the + * <code>allowDuplicateXValues</code> flag is not set for this series. */ public void add(Number x, Number y) { // argument checking delegated... @@ -537,8 +542,7 @@ /** * Adds or updates an item in the series and sends a - * {@link org.jfree.data.general.SeriesChangeEvent} to all registered - * listeners. + * {@link SeriesChangeEvent} to all registered listeners. * * @param x the x-value (<code>null</code> not permitted). * @param y the y-value (<code>null</code> permitted). @@ -550,9 +554,15 @@ if (x == null) { throw new IllegalArgumentException("Null 'x' argument."); } + if (this.allowDuplicateXValues) { + add(x, y); + return null; + } + + // if we get to here, we know that duplicate X values are not permitted XYDataItem overwritten = null; int index = indexOf(x); - if (index >= 0 && !this.allowDuplicateXValues) { + if (index >= 0) { XYDataItem existing = (XYDataItem) this.data.get(index); try { overwritten = (XYDataItem) existing.clone(); Modified: branches/jfreechart-1.0.x-branch/tests/org/jfree/data/xy/junit/XYSeriesTests.java =================================================================== --- branches/jfreechart-1.0.x-branch/tests/org/jfree/data/xy/junit/XYSeriesTests.java 2008-11-24 09:19:36 UTC (rev 1696) +++ branches/jfreechart-1.0.x-branch/tests/org/jfree/data/xy/junit/XYSeriesTests.java 2008-11-24 09:48:01 UTC (rev 1697) @@ -39,6 +39,7 @@ * 30-Jan-2007 : Fixed some code that won't compile with Java 1.4 (DG); * 31-Oct-2007 : New hashCode() test (DG); * 01-May-2008 : Added testAddOrUpdate3() (DG); + * 24-Nov-2008 : Added testBug1955483() (DG); * */ @@ -469,4 +470,16 @@ assertTrue(Double.isNaN(dataset.getYValue(0, 3))); } + /** + * Another test for the addOrUpdate() method. + */ + public void testBug1955483() { + XYSeries series = new XYSeries("Series", true, true); + series.addOrUpdate(1.0, 1.0); + series.addOrUpdate(1.0, 2.0); + assertEquals(new Double(1.0), series.getY(0)); + assertEquals(new Double(2.0), series.getY(1)); + assertEquals(2, series.getItemCount()); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:10:56
|
Revision: 1698 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1698&view=rev Author: mungady Date: 2008-11-25 08:10:46 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AreaRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/AreaRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/AreaRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/AreaRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AreaRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AreaRenderer.java 2008-11-24 09:48:01 UTC (rev 1697) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AreaRenderer.java 2008-11-25 08:10:46 UTC (rev 1698) @@ -93,7 +93,12 @@ /** * A category item renderer that draws area charts. You can use this renderer - * with the {@link org.jfree.chart.plot.CategoryPlot} class. + * with the {@link CategoryPlot} class. The example shown here is generated + * by the <code>AreaChartDemo1.java</code> program included in the JFreeChart + * Demo Collection: + * <br><br> + * <img src="../../../../../images/AreaRendererSample.png" + * alt="AreaRendererSample.png" /> */ public class AreaRenderer extends AbstractCategoryItemRenderer implements Cloneable, PublicCloneable, Serializable { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:11:15
|
Revision: 1699 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1699&view=rev Author: mungady Date: 2008-11-25 08:11:11 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/BarRenderer3D.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/BarRenderer3DSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/BarRenderer3DSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/BarRenderer3DSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/BarRenderer3D.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/BarRenderer3D.java 2008-11-25 08:10:46 UTC (rev 1698) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/BarRenderer3D.java 2008-11-25 08:11:11 UTC (rev 1699) @@ -140,7 +140,12 @@ /** * A renderer for bars with a 3D effect, for use with the - * {@link org.jfree.chart.plot.CategoryPlot} class. + * {@link CategoryPlot} class. The example shown here is generated + * by the <code>BarChart3DDemo1.java</code> program included in the JFreeChart + * Demo Collection: + * <br><br> + * <img src="../../../../../images/BarRenderer3DSample.png" + * alt="BarRenderer3DSample.png" /> */ public class BarRenderer3D extends BarRenderer implements Effect3D, Cloneable, PublicCloneable, Serializable { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:11:56
|
Revision: 1700 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1700&view=rev Author: mungady Date: 2008-11-25 08:11:48 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/BoxAndWhiskerRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/BoxAndWhiskerRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/BoxAndWhiskerRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.java 2008-11-25 08:11:11 UTC (rev 1699) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.java 2008-11-25 08:11:48 UTC (rev 1700) @@ -116,7 +116,12 @@ /** * A box-and-whisker renderer. This renderer requires a * {@link BoxAndWhiskerCategoryDataset} and is for use with the - * {@link CategoryPlot} class. + * {@link CategoryPlot} class. The example shown here is generated + * by the <code>BoxAndWhiskerChartDemo1.java</code> program included in the + * JFreeChart Demo Collection: + * <br><br> + * <img src="../../../../../images/BoxAndWhiskerRendererSample.png" + * alt="BoxAndWhiskerRendererSample.png" /> */ public class BoxAndWhiskerRenderer extends AbstractCategoryItemRenderer implements Cloneable, PublicCloneable, Serializable { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:12:30
|
Revision: 1701 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1701&view=rev Author: mungady Date: 2008-11-25 08:12:20 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/CategoryStepRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/CategoryStepRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/CategoryStepRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/CategoryStepRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/CategoryStepRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/CategoryStepRenderer.java 2008-11-25 08:11:48 UTC (rev 1700) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/CategoryStepRenderer.java 2008-11-25 08:12:20 UTC (rev 1701) @@ -72,7 +72,12 @@ /** * A "step" renderer similar to {@link XYStepRenderer} but - * that can be used with the {@link CategoryPlot} class. + * that can be used with the {@link CategoryPlot} class. The example shown + * here is generated by the <code>CategoryStepChartDemo1.java</code> program + * included in the JFreeChart Demo Collection: + * <br><br> + * <img src="../../../../../images/CategoryStepRendererSample.png" + * alt="CategoryStepRendererSample.png" /> */ public class CategoryStepRenderer extends AbstractCategoryItemRenderer implements Cloneable, PublicCloneable, Serializable { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:16:51
|
Revision: 1703 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1703&view=rev Author: mungady Date: 2008-11-25 08:16:40 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/GanttRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/GanttRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/GanttRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/GanttRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/GanttRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/GanttRenderer.java 2008-11-25 08:15:57 UTC (rev 1702) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/GanttRenderer.java 2008-11-25 08:16:40 UTC (rev 1703) @@ -77,7 +77,12 @@ import org.jfree.util.PaintUtilities; /** - * A renderer for simple Gantt charts. + * A renderer for simple Gantt charts. The example shown + * here is generated by the <code>GanttDemo1.java</code> program + * included in the JFreeChart Demo Collection: + * <br><br> + * <img src="../../../../../images/GanttRendererSample.png" + * alt="GanttRendererSample.png" /> */ public class GanttRenderer extends IntervalBarRenderer implements Serializable { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:17:48
|
Revision: 1704 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1704&view=rev Author: mungady Date: 2008-11-25 08:17:38 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/IntervalBarRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/IntervalBarRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/IntervalBarRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/IntervalBarRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/IntervalBarRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/IntervalBarRenderer.java 2008-11-25 08:16:40 UTC (rev 1703) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/IntervalBarRenderer.java 2008-11-25 08:17:38 UTC (rev 1704) @@ -78,7 +78,12 @@ /** * A renderer that handles the drawing of bars for a bar plot where * each bar has a high and low value. This renderer is for use with the - * {@link CategoryPlot} class. + * {@link CategoryPlot} class. The example shown here is generated by the + * <code>IntervalBarChartDemo1.java</code> program included in the JFreeChart + * Demo Collection: + * <br><br> + * <img src="../../../../../images/IntervalBarRendererSample.png" + * alt="IntervalBarRendererSample.png" /> */ public class IntervalBarRenderer extends BarRenderer { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:18:38
|
Revision: 1705 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1705&view=rev Author: mungady Date: 2008-11-25 08:18:34 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/LayeredBarRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/LayeredBarRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/LayeredBarRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/LayeredBarRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/LayeredBarRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/LayeredBarRenderer.java 2008-11-25 08:17:38 UTC (rev 1704) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/LayeredBarRenderer.java 2008-11-25 08:18:34 UTC (rev 1705) @@ -74,7 +74,12 @@ /** * A {@link CategoryItemRenderer} that represents data using bars which are - * superimposed. + * superimposed. The example shown here is generated by the + * <code>LayeredBarChartDemo1.java</code> program included in the JFreeChart + * Demo Collection: + * <br><br> + * <img src="../../../../../images/LayeredBarRendererSample.png" + * alt="LayeredBarRendererSample.png" /> */ public class LayeredBarRenderer extends BarRenderer implements Serializable { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:20:12
|
Revision: 1706 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1706&view=rev Author: mungady Date: 2008-11-25 08:20:04 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/LevelRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/LevelRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/LevelRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/LevelRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/LevelRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/LevelRenderer.java 2008-11-25 08:18:34 UTC (rev 1705) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/LevelRenderer.java 2008-11-25 08:20:04 UTC (rev 1706) @@ -68,7 +68,13 @@ /** * A {@link CategoryItemRenderer} that draws individual data items as - * horizontal lines, spaced in the same way as bars in a bar chart. + * horizontal lines, spaced in the same way as bars in a bar chart. The + * example shown here is generated by the + * <code>OverlaidBarChartDemo2.java</code> program included in the JFreeChart + * Demo Collection: + * <br><br> + * <img src="../../../../../images/LevelRendererSample.png" + * alt="LevelRendererSample.png" /> */ public class LevelRenderer extends AbstractCategoryItemRenderer implements Cloneable, PublicCloneable, Serializable { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:23:04
|
Revision: 1709 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1709&view=rev Author: mungady Date: 2008-11-25 08:22:48 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/LineRenderer3D.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/LineRenderer3DSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/LineRenderer3DSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/LineRenderer3DSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/LineRenderer3D.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/LineRenderer3D.java 2008-11-25 08:22:14 UTC (rev 1708) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/LineRenderer3D.java 2008-11-25 08:22:48 UTC (rev 1709) @@ -84,7 +84,12 @@ import org.jfree.util.ShapeUtilities; /** - * A line renderer with a 3D effect. + * A line renderer with a 3D effect. The example shown here is generated by + * the <code>LineChart3DDemo1.java</code> program included in the JFreeChart + * Demo Collection: + * <br><br> + * <img src="../../../../../images/LineRenderer3DSample.png" + * alt="LineRenderer3DSample.png" /> */ public class LineRenderer3D extends LineAndShapeRenderer implements Effect3D, Serializable { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:23:46
|
Revision: 1710 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1710&view=rev Author: mungady Date: 2008-11-25 08:23:41 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/MinMaxCategoryRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/MinMaxCategoryRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/MinMaxCategoryRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/MinMaxCategoryRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/MinMaxCategoryRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/MinMaxCategoryRenderer.java 2008-11-25 08:22:48 UTC (rev 1709) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/MinMaxCategoryRenderer.java 2008-11-25 08:23:41 UTC (rev 1710) @@ -91,9 +91,13 @@ /** * Renderer for drawing min max plot. This renderer draws all the series under * the same category in the same x position using <code>objectIcon</code> and - * a line from the maximum value to the minimum value. - * <p> - * For use with the {@link org.jfree.chart.plot.CategoryPlot} class. + * a line from the maximum value to the minimum value. For use with the + * {@link CategoryPlot} class. The example shown here is generated by + * the <code>MinMaxCategoryPlotDemo1.java</code> program included in the + * JFreeChart Demo Collection: + * <br><br> + * <img src="../../../../../images/MinMaxCategoryRendererSample.png" + * alt="MinMaxCategoryRendererSample.png" /> */ public class MinMaxCategoryRenderer extends AbstractCategoryItemRenderer { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:24:27
|
Revision: 1711 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1711&view=rev Author: mungady Date: 2008-11-25 08:24:19 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/ScatterRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/ScatterRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/ScatterRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/ScatterRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/ScatterRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/ScatterRenderer.java 2008-11-25 08:23:41 UTC (rev 1710) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/ScatterRenderer.java 2008-11-25 08:24:19 UTC (rev 1711) @@ -71,7 +71,12 @@ /** * A renderer that handles the multiple values from a * {@link MultiValueCategoryDataset} by plotting a shape for each value for - * each given item in the dataset. + * each given item in the dataset. The example shown here is generated by + * the <code>ScatterRendererDemo1.java</code> program included in the + * JFreeChart Demo Collection: + * <br><br> + * <img src="../../../../../images/ScatterRendererSample.png" + * alt="ScatterRendererSample.png" /> * * @since 1.0.7 */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:25:55
|
Revision: 1712 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1712&view=rev Author: mungady Date: 2008-11-25 08:25:51 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StackedAreaRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/StackedAreaRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/StackedAreaRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/StackedAreaRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StackedAreaRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StackedAreaRenderer.java 2008-11-25 08:24:19 UTC (rev 1711) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StackedAreaRenderer.java 2008-11-25 08:25:51 UTC (rev 1712) @@ -82,8 +82,13 @@ import org.jfree.util.PublicCloneable; /** - * A renderer that draws stacked area charts for a - * {@link org.jfree.chart.plot.CategoryPlot}. + * A renderer that draws stacked area charts for a {@link CategoryPlot}. + * The example shown here is generated by the + * <code>StackedAreaChartDemo1.java</code> program included in the + * JFreeChart Demo Collection: + * <br><br> + * <img src="../../../../../images/StackedAreaRendererSample.png" + * alt="StackedAreaRendererSample.png" /> */ public class StackedAreaRenderer extends AreaRenderer implements Cloneable, PublicCloneable, Serializable { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:26:36
|
Revision: 1713 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1713&view=rev Author: mungady Date: 2008-11-25 08:26:30 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StackedBarRenderer3D.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/StackedBarRenderer3DSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/StackedBarRenderer3DSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/StackedBarRenderer3DSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StackedBarRenderer3D.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StackedBarRenderer3D.java 2008-11-25 08:25:51 UTC (rev 1712) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StackedBarRenderer3D.java 2008-11-25 08:26:30 UTC (rev 1713) @@ -112,8 +112,13 @@ import org.jfree.util.PublicCloneable; /** - * Renders stacked bars with 3D-effect, for use with the - * {@link org.jfree.chart.plot.CategoryPlot} class. + * Renders stacked bars with 3D-effect, for use with the {@link CategoryPlot} + * class. The example shown here is generated by the + * <code>StackedBarChart3DDemo1.java</code> program included in the + * JFreeChart Demo Collection: + * <br><br> + * <img src="../../../../../images/StackedBarRenderer3DSample.png" + * alt="StackedBarRenderer3DSample.png" /> */ public class StackedBarRenderer3D extends BarRenderer3D implements Cloneable, PublicCloneable, Serializable { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:27:21
|
Revision: 1714 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1714&view=rev Author: mungady Date: 2008-11-25 08:27:12 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StatisticalBarRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/StatisticalBarRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/StatisticalBarRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/StatisticalBarRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StatisticalBarRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StatisticalBarRenderer.java 2008-11-25 08:26:30 UTC (rev 1713) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StatisticalBarRenderer.java 2008-11-25 08:27:12 UTC (rev 1714) @@ -88,7 +88,12 @@ /** * A renderer that handles the drawing a bar plot where - * each bar has a mean value and a standard deviation line. + * each bar has a mean value and a standard deviation line. The example shown + * here is generated by the <code>StatisticalBarChartDemo1.java</code> program + * included in the JFreeChart Demo Collection: + * <br><br> + * <img src="../../../../../images/StatisticalBarRendererSample.png" + * alt="StatisticalBarRendererSample.png" /> */ public class StatisticalBarRenderer extends BarRenderer implements CategoryItemRenderer, Cloneable, PublicCloneable, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:27:59
|
Revision: 1715 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1715&view=rev Author: mungady Date: 2008-11-25 08:27:50 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StatisticalLineAndShapeRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/StatisticalLineRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/StatisticalLineRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/StatisticalLineRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StatisticalLineAndShapeRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StatisticalLineAndShapeRenderer.java 2008-11-25 08:27:12 UTC (rev 1714) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StatisticalLineAndShapeRenderer.java 2008-11-25 08:27:50 UTC (rev 1715) @@ -79,7 +79,12 @@ /** * A renderer that draws shapes for each data item, and lines between data * items. Each point has a mean value and a standard deviation line. For use - * with the {@link CategoryPlot} class. + * with the {@link CategoryPlot} class. The example shown + * here is generated by the <code>StatisticalLineChartDemo1.java</code> program + * included in the JFreeChart Demo Collection: + * <br><br> + * <img src="../../../../../images/StatisticalLineRendererSample.png" + * alt="StatisticalLineRendererSample.png" /> */ public class StatisticalLineAndShapeRenderer extends LineAndShapeRenderer implements Cloneable, PublicCloneable, Serializable { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:28:08
|
Revision: 1716 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1716&view=rev Author: mungady Date: 2008-11-25 08:28:07 +0000 (Tue, 25 Nov 2008) Log Message: ----------- Updated API docs. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/WaterfallBarRenderer.java Added Paths: ----------- branches/jfreechart-1.0.x-branch/docfiles/WaterfallBarRendererSample.png Added: branches/jfreechart-1.0.x-branch/docfiles/WaterfallBarRendererSample.png =================================================================== (Binary files differ) Property changes on: branches/jfreechart-1.0.x-branch/docfiles/WaterfallBarRendererSample.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/WaterfallBarRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/WaterfallBarRenderer.java 2008-11-25 08:27:50 UTC (rev 1715) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/WaterfallBarRenderer.java 2008-11-25 08:28:07 UTC (rev 1716) @@ -93,6 +93,12 @@ * inherited methods (for example, * {@link AbstractRenderer#setSeriesPaint(int, Paint)}) are ignored;</li> * </ul> + * The example shown here is generated by the + * <code>WaterfallChartDemo1.java</code> program included in the JFreeChart + * Demo Collection: + * <br><br> + * <img src="../../../../../images/WaterfallBarRendererSample.png" + * alt="WaterfallBarRendererSample.png" /> */ public class WaterfallBarRenderer extends BarRenderer { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 08:46:12
|
Revision: 1718 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1718&view=rev Author: mungady Date: 2008-11-25 08:46:08 +0000 (Tue, 25 Nov 2008) Log Message: ----------- 2008-11-25 David Gilbert <dav...@ob...> * source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java (findRangeBounds): Check for null argument, * source/org/jfree/chart/renderer/category/BarRenderer.java (findRangeBounds): Likewise, * source/org/jfree/chart/renderer/category/GroupedStackedBarRenderer.java (findRangeBounds): Likewise, * source/org/jfree/chart/renderer/category/StackedBarRenderer.java (findRangeBounds): Likewise. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/BarRenderer.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/GroupedStackedBarRenderer.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StackedBarRenderer.java branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/AbstractCategoryItemRendererTests.java branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/BarRendererTests.java branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/GroupedStackedBarRendererTests.java branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/StackedBarRendererTests.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2008-11-25 08:43:58 UTC (rev 1717) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2008-11-25 08:46:08 UTC (rev 1718) @@ -1,3 +1,14 @@ +2008-11-25 David Gilbert <dav...@ob...> + + * source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java + (findRangeBounds): Check for null argument, + * source/org/jfree/chart/renderer/category/BarRenderer.java + (findRangeBounds): Likewise, + * source/org/jfree/chart/renderer/category/GroupedStackedBarRenderer.java + (findRangeBounds): Likewise, + * source/org/jfree/chart/renderer/category/StackedBarRenderer.java + (findRangeBounds): Likewise. + 2008-11-24 David Gilbert <dav...@ob...> Bug 1955483: Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java 2008-11-25 08:43:58 UTC (rev 1717) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java 2008-11-25 08:46:08 UTC (rev 1718) @@ -95,6 +95,7 @@ * 18-May-2007 : Set dataset and seriesKey for LegendItem (DG); * 17-Jun-2008 : Apply legend shape, font and paint attributes (DG); * 26-Jun-2008 : Added crosshair support (DG); + * 25-Nov-2008 : Fixed bug in findRangeBounds() method (DG); * */ @@ -672,6 +673,9 @@ * <code>null</code> or empty). */ public Range findRangeBounds(CategoryDataset dataset) { + if (dataset == null) { + return null; + } return DatasetUtilities.findRangeBounds(dataset); } Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/BarRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/BarRenderer.java 2008-11-25 08:43:58 UTC (rev 1717) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/BarRenderer.java 2008-11-25 08:46:08 UTC (rev 1718) @@ -864,6 +864,9 @@ * <code>null</code> or empty). */ public Range findRangeBounds(CategoryDataset dataset) { + if (dataset == null) { + return null; + } Range result = DatasetUtilities.findRangeBounds(dataset); if (result != null) { if (this.includeBaseInRange) { Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/GroupedStackedBarRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/GroupedStackedBarRenderer.java 2008-11-25 08:43:58 UTC (rev 1717) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/GroupedStackedBarRenderer.java 2008-11-25 08:46:08 UTC (rev 1718) @@ -68,7 +68,12 @@ /** * A renderer that draws stacked bars within groups. This will probably be - * merged with the {@link StackedBarRenderer} class at some point. + * merged with the {@link StackedBarRenderer} class at some point. The example + * shown here is generated by the <code>StackedBarChartDemo4.java</code> + * program included in the JFreeChart Demo Collection: + * <br><br> + * <img src="../../../../../images/GroupedStackedBarRendererSample.png" + * alt="GroupedStackedBarRendererSample.png" /> */ public class GroupedStackedBarRenderer extends StackedBarRenderer implements Cloneable, PublicCloneable, Serializable { @@ -111,6 +116,9 @@ * <code>null</code> or empty). */ public Range findRangeBounds(CategoryDataset dataset) { + if (dataset == null) { + return null; + } Range r = DatasetUtilities.findStackedRangeBounds( dataset, this.seriesToGroupMap); return r; Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StackedBarRenderer.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StackedBarRenderer.java 2008-11-25 08:43:58 UTC (rev 1717) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/renderer/category/StackedBarRenderer.java 2008-11-25 08:46:08 UTC (rev 1718) @@ -114,8 +114,13 @@ import org.jfree.util.PublicCloneable; /** - * A stacked bar renderer for use with the - * {@link org.jfree.chart.plot.CategoryPlot} class. + * A stacked bar renderer for use with the {@link CategoryPlot} class. + * The example shown here is generated by the + * <code>StackedBarChartDemo1.java</code> program included in the + * JFreeChart Demo Collection: + * <br><br> + * <img src="../../../../../images/StackedBarRendererSample.png" + * alt="StackedBarRendererSample.png" /> */ public class StackedBarRenderer extends BarRenderer implements Cloneable, PublicCloneable, Serializable { @@ -205,6 +210,9 @@ * @return The range (or <code>null</code> if the dataset is empty). */ public Range findRangeBounds(CategoryDataset dataset) { + if (dataset == null) { + return null; + } if (this.renderAsPercentages) { return new Range(0.0, 1.0); } Modified: branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/AbstractCategoryItemRendererTests.java =================================================================== --- branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/AbstractCategoryItemRendererTests.java 2008-11-25 08:43:58 UTC (rev 1717) +++ branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/AbstractCategoryItemRendererTests.java 2008-11-25 08:46:08 UTC (rev 1718) @@ -37,6 +37,7 @@ * 12-Feb-2004 : Version 1 (DG); * 24-Nov-2006 : New cloning tests (DG); * 07-Dec-2006 : Added testEquals() method (DG); + * 25-Nov-2008 : Added testFindRangeBounds() (DG); * */ @@ -54,7 +55,10 @@ import org.jfree.chart.labels.StandardCategoryToolTipGenerator; import org.jfree.chart.renderer.category.AbstractCategoryItemRenderer; import org.jfree.chart.renderer.category.BarRenderer; +import org.jfree.chart.renderer.category.LineAndShapeRenderer; import org.jfree.chart.urls.StandardCategoryURLGenerator; +import org.jfree.data.Range; +import org.jfree.data.category.DefaultCategoryDataset; /** * Tests for the {@link AbstractCategoryItemRenderer} class. @@ -329,5 +333,26 @@ != r2.getLegendItemURLGenerator()); } + /** + * Some checks for the findRangeBounds() method. + */ + public void testFindRangeBounds() { + AbstractCategoryItemRenderer r = new LineAndShapeRenderer(); + assertNull(r.findRangeBounds(null)); + + // an empty dataset should return a null range + DefaultCategoryDataset dataset = new DefaultCategoryDataset(); + assertNull(r.findRangeBounds(dataset)); + + dataset.addValue(1.0, "R1", "C1"); + assertEquals(new Range(1.0, 1.0), r.findRangeBounds(dataset)); + + dataset.addValue(-2.0, "R1", "C2"); + assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); + + dataset.addValue(null, "R1", "C3"); + assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); + } + } Modified: branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/BarRendererTests.java =================================================================== --- branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/BarRendererTests.java 2008-11-25 08:43:58 UTC (rev 1717) +++ branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/BarRendererTests.java 2008-11-25 08:46:08 UTC (rev 1718) @@ -41,6 +41,7 @@ * 22-Sep-2005 : Renamed getMaxBarWidth() --> getMaximumBarWidth() (DG); * 11-May-2007 : Added testGetLegendItem() (DG); * 23-Apr-2008 : Added testPublicCloneable() (DG); + * 25-Nov-2008 : Added testFindRangeBounds (DG); * */ @@ -69,6 +70,7 @@ import org.jfree.chart.renderer.category.BarRenderer; import org.jfree.chart.renderer.category.GradientBarPainter; import org.jfree.chart.renderer.junit.RendererChangeDetector; +import org.jfree.data.Range; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.ui.GradientPaintTransformType; import org.jfree.ui.StandardGradientPaintTransformer; @@ -312,4 +314,28 @@ assertEquals(2, li.getSeriesIndex()); } + /** + * Some checks for the findRangeBounds() method. + */ + public void testFindRangeBounds() { + BarRenderer r = new BarRenderer(); + assertNull(r.findRangeBounds(null)); + + // an empty dataset should return a null range + DefaultCategoryDataset dataset = new DefaultCategoryDataset(); + assertNull(r.findRangeBounds(dataset)); + + dataset.addValue(1.0, "R1", "C1"); + assertEquals(new Range(0.0, 1.0), r.findRangeBounds(dataset)); + r.setIncludeBaseInRange(false); + assertEquals(new Range(1.0, 1.0), r.findRangeBounds(dataset)); + r.setIncludeBaseInRange(true); + + dataset.addValue(-2.0, "R1", "C2"); + assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); + + dataset.addValue(null, "R1", "C3"); + assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); + } + } Modified: branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/GroupedStackedBarRendererTests.java =================================================================== --- branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/GroupedStackedBarRendererTests.java 2008-11-25 08:43:58 UTC (rev 1717) +++ branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/GroupedStackedBarRendererTests.java 2008-11-25 08:46:08 UTC (rev 1718) @@ -58,6 +58,7 @@ import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.renderer.category.GroupedStackedBarRenderer; import org.jfree.data.KeyToGroupMap; +import org.jfree.data.Range; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.util.PublicCloneable; @@ -183,4 +184,37 @@ assertTrue(success); } + /** + * Some checks for the findRangeBounds() method. + */ + public void testFindRangeBounds() { + GroupedStackedBarRenderer r = new GroupedStackedBarRenderer(); + assertNull(r.findRangeBounds(null)); + + // an empty dataset should return a null range + DefaultCategoryDataset dataset = new DefaultCategoryDataset(); + assertNull(r.findRangeBounds(dataset)); + + dataset.addValue(1.0, "R1", "C1"); + assertEquals(new Range(0.0, 1.0), r.findRangeBounds(dataset)); + + dataset.addValue(-2.0, "R1", "C2"); + assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); + + dataset.addValue(null, "R1", "C3"); + assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); + + KeyToGroupMap m = new KeyToGroupMap("G1"); + m.mapKeyToGroup("R1", "G1"); + m.mapKeyToGroup("R2", "G1"); + m.mapKeyToGroup("R3", "G2"); + r.setSeriesToGroupMap(m); + + dataset.addValue(0.5, "R3", "C1"); + assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); + + dataset.addValue(5.0, "R3", "C2"); + assertEquals(new Range(-2.0, 5.0), r.findRangeBounds(dataset)); + } + } Modified: branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/StackedBarRendererTests.java =================================================================== --- branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/StackedBarRendererTests.java 2008-11-25 08:43:58 UTC (rev 1717) +++ branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/renderer/category/junit/StackedBarRendererTests.java 2008-11-25 08:46:08 UTC (rev 1718) @@ -53,6 +53,8 @@ import junit.framework.TestSuite; import org.jfree.chart.renderer.category.StackedBarRenderer; +import org.jfree.data.Range; +import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.util.PublicCloneable; /** @@ -145,8 +147,7 @@ out.close(); ObjectInput in = new ObjectInputStream( - new ByteArrayInputStream(buffer.toByteArray()) - ); + new ByteArrayInputStream(buffer.toByteArray())); r2 = (StackedBarRenderer) in.readObject(); in.close(); } @@ -157,4 +158,31 @@ } + /** + * Some checks for the findRangeBounds() method. + */ + public void testFindRangeBounds() { + StackedBarRenderer r = new StackedBarRenderer(); + assertNull(r.findRangeBounds(null)); + + // an empty dataset should return a null range + DefaultCategoryDataset dataset = new DefaultCategoryDataset(); + assertNull(r.findRangeBounds(dataset)); + + dataset.addValue(1.0, "R1", "C1"); + assertEquals(new Range(0.0, 1.0), r.findRangeBounds(dataset)); + + dataset.addValue(-2.0, "R1", "C2"); + assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); + + dataset.addValue(null, "R1", "C3"); + assertEquals(new Range(-2.0, 1.0), r.findRangeBounds(dataset)); + + dataset.addValue(2.0, "R2", "C1"); + assertEquals(new Range(-2.0, 3.0), r.findRangeBounds(dataset)); + + dataset.addValue(null, "R2", "C2"); + assertEquals(new Range(-2.0, 3.0), r.findRangeBounds(dataset)); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 09:11:32
|
Revision: 1719 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1719&view=rev Author: mungady Date: 2008-11-25 09:11:27 +0000 (Tue, 25 Nov 2008) Log Message: ----------- 2008-11-25 David Gilbert <dav...@ob...> Based on patch 1868749 by Andrew Mickish: * source/org/jfree/chart/plot/CategoryPlot.java (datasetToDomainAxisMap): Changed from ObjectList to TreeMap, (datasetToRangeAxisMap): Likewise, (CategoryPlot): Updated initialization of modified fields, (mapDatasetToDomainAxis): Delegate to new method, (mapDatasetToDomainAxes): New method, (checkAxisIndices): New private method, (getDomainAxisForDataset): Updated for multiple axis support, (mapDatasetToRangeAxis): Delegate to new method, (mapDatasetToRangeAxes): New method, (getRangeAxisForDataset): Updated for multiple axis support, (datasetsMappedToDomainAxis): Likewise, (datasetsMappedToRangeAxis): Likewise, (equals): Updated for field changes, (clone): Likewise, * source/org/jfree/chart/plot/XYPlot.java (datasetToDomainAxisMap): Renamed, (datasetToRangeAxisMap): Renamed, (XYPlot): Updated for renamed fields, (mapDatasetToDomainAxis): Delegate to new method, (mapDatasetToDomainAxes): New method, (mapDatasetToRangeAxis): Delegate to new method, (mapDatasetToRangeAxes): New method, (checkAxisIndices): New private method, (getDomainAxisForDataset): Updated for multiple axis support, (getRangeAxisForDataset): Likewise, (getDatasetsMappedToDomainAxis): Likewise, (getDatasetsMappedToRangeAxis): Likewise, (equals): Updated for field changes, (clone): Likewise. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/CategoryPlot.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/XYPlot.java branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/CategoryPlotTests.java branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/XYPlotTests.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2008-11-25 08:46:08 UTC (rev 1718) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2008-11-25 09:11:27 UTC (rev 1719) @@ -1,5 +1,39 @@ 2008-11-25 David Gilbert <dav...@ob...> + Based on patch 1868749 by Andrew Mickish: + * source/org/jfree/chart/plot/CategoryPlot.java + (datasetToDomainAxisMap): Changed from ObjectList to TreeMap, + (datasetToRangeAxisMap): Likewise, + (CategoryPlot): Updated initialization of modified fields, + (mapDatasetToDomainAxis): Delegate to new method, + (mapDatasetToDomainAxes): New method, + (checkAxisIndices): New private method, + (getDomainAxisForDataset): Updated for multiple axis support, + (mapDatasetToRangeAxis): Delegate to new method, + (mapDatasetToRangeAxes): New method, + (getRangeAxisForDataset): Updated for multiple axis support, + (datasetsMappedToDomainAxis): Likewise, + (datasetsMappedToRangeAxis): Likewise, + (equals): Updated for field changes, + (clone): Likewise, + * source/org/jfree/chart/plot/XYPlot.java + (datasetToDomainAxisMap): Renamed, + (datasetToRangeAxisMap): Renamed, + (XYPlot): Updated for renamed fields, + (mapDatasetToDomainAxis): Delegate to new method, + (mapDatasetToDomainAxes): New method, + (mapDatasetToRangeAxis): Delegate to new method, + (mapDatasetToRangeAxes): New method, + (checkAxisIndices): New private method, + (getDomainAxisForDataset): Updated for multiple axis support, + (getRangeAxisForDataset): Likewise, + (getDatasetsMappedToDomainAxis): Likewise, + (getDatasetsMappedToRangeAxis): Likewise, + (equals): Updated for field changes, + (clone): Likewise. + +2008-11-25 David Gilbert <dav...@ob...> + * source/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java (findRangeBounds): Check for null argument, * source/org/jfree/chart/renderer/category/BarRenderer.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/CategoryPlot.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/CategoryPlot.java 2008-11-25 08:46:08 UTC (rev 1718) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/CategoryPlot.java 2008-11-25 09:11:27 UTC (rev 1719) @@ -161,6 +161,7 @@ * 26-Jun-2008 : Fixed crosshair support (DG); * 10-Jul-2008 : Fixed outline visibility for 3D renderers (DG); * 12-Aug-2008 : Added rendererCount() method (DG); + * 25-Nov-2008 : Added facility to map datasets to multiples axes (DG); * */ @@ -186,11 +187,13 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.ResourceBundle; import java.util.Set; +import java.util.TreeMap; import org.jfree.chart.LegendItem; import org.jfree.chart.LegendItemCollection; @@ -316,10 +319,10 @@ private ObjectList datasets; /** Storage for keys that map datasets to domain axes. */ - private ObjectList datasetToDomainAxisMap; + private TreeMap datasetToDomainAxesMap; /** Storage for keys that map datasets to range axes. */ - private ObjectList datasetToRangeAxisMap; + private TreeMap datasetToRangeAxesMap; /** Storage for the renderers. */ private ObjectList renderers; @@ -499,8 +502,8 @@ this.rangeAxes = new ObjectList(); this.rangeAxisLocations = new ObjectList(); - this.datasetToDomainAxisMap = new ObjectList(); - this.datasetToRangeAxisMap = new ObjectList(); + this.datasetToDomainAxesMap = new TreeMap(); + this.datasetToRangeAxesMap = new TreeMap(); this.renderers = new ObjectList(); @@ -1308,12 +1311,65 @@ * @see #getDomainAxisForDataset(int) */ public void mapDatasetToDomainAxis(int index, int axisIndex) { - this.datasetToDomainAxisMap.set(index, new Integer(axisIndex)); + List axisIndices = new java.util.ArrayList(1); + axisIndices.add(new Integer(axisIndex)); + mapDatasetToDomainAxes(index, axisIndices); + } + + /** + * Maps the specified dataset to the axes in the list. Note that the + * conversion of data values into Java2D space is always performed using + * the first axis in the list. + * + * @param index the dataset index (zero-based). + * @param axisIndices the axis indices (<code>null</code> permitted). + * + * @since 1.0.12 + */ + public void mapDatasetToDomainAxes(int index, List axisIndices) { + if (index < 0) { + throw new IllegalArgumentException("Requires 'index' >= 0."); + } + checkAxisIndices(axisIndices); + Integer key = new Integer(index); + this.datasetToDomainAxesMap.put(key, new ArrayList(axisIndices)); // fake a dataset change event to update axes... datasetChanged(new DatasetChangeEvent(this, getDataset(index))); } /** + * This method is used to perform argument checking on the list of + * axis indices passed to mapDatasetToDomainAxes() and + * mapDatasetToRangeAxes(). + * + * @param indices the list of indices (<code>null</code> permitted). + */ + private void checkAxisIndices(List indices) { + // axisIndices can be: + // 1. null; + // 2. non-empty, containing only Integer objects that are unique. + if (indices == null) { + return; // OK + } + int count = indices.size(); + if (count == 0) { + throw new IllegalArgumentException("Empty list not permitted."); + } + HashSet set = new HashSet(); + for (int i = 0; i < count; i++) { + Object item = indices.get(i); + if (!(item instanceof Integer)) { + throw new IllegalArgumentException( + "Indices must be Integer instances."); + } + if (set.contains(item)) { + throw new IllegalArgumentException("Indices must be unique."); + } + set.add(item); + } + } + + /** * Returns the domain axis for a dataset. You can change the axis for a * dataset using the {@link #mapDatasetToDomainAxis(int, int)} method. * @@ -1324,12 +1380,21 @@ * @see #mapDatasetToDomainAxis(int, int) */ public CategoryAxis getDomainAxisForDataset(int index) { - CategoryAxis result = getDomainAxis(); - Integer axisIndex = (Integer) this.datasetToDomainAxisMap.get(index); - if (axisIndex != null) { - result = getDomainAxis(axisIndex.intValue()); + if (index < 0) { + throw new IllegalArgumentException("Negative 'index'."); } - return result; + CategoryAxis axis = null; + List axisIndices = (List) this.datasetToDomainAxesMap.get( + new Integer(index)); + if (axisIndices != null) { + // the first axis in the list is used for data <--> Java2D + Integer axisIndex = (Integer) axisIndices.get(0); + axis = getDomainAxis(axisIndex.intValue()); + } + else { + axis = getDomainAxis(0); + } + return axis; } /** @@ -1341,7 +1406,28 @@ * @see #getRangeAxisForDataset(int) */ public void mapDatasetToRangeAxis(int index, int axisIndex) { - this.datasetToRangeAxisMap.set(index, new Integer(axisIndex)); + List axisIndices = new java.util.ArrayList(1); + axisIndices.add(new Integer(axisIndex)); + mapDatasetToRangeAxes(index, axisIndices); + } + + /** + * Maps the specified dataset to the axes in the list. Note that the + * conversion of data values into Java2D space is always performed using + * the first axis in the list. + * + * @param index the dataset index (zero-based). + * @param axisIndices the axis indices (<code>null</code> permitted). + * + * @since 1.0.12 + */ + public void mapDatasetToRangeAxes(int index, List axisIndices) { + if (index < 0) { + throw new IllegalArgumentException("Requires 'index' >= 0."); + } + checkAxisIndices(axisIndices); + Integer key = new Integer(index); + this.datasetToRangeAxesMap.put(key, new ArrayList(axisIndices)); // fake a dataset change event to update axes... datasetChanged(new DatasetChangeEvent(this, getDataset(index))); } @@ -1357,12 +1443,21 @@ * @see #mapDatasetToRangeAxis(int, int) */ public ValueAxis getRangeAxisForDataset(int index) { - ValueAxis result = getRangeAxis(); - Integer axisIndex = (Integer) this.datasetToRangeAxisMap.get(index); - if (axisIndex != null) { - result = getRangeAxis(axisIndex.intValue()); + if (index < 0) { + throw new IllegalArgumentException("Negative 'index'."); } - return result; + ValueAxis axis = null; + List axisIndices = (List) this.datasetToRangeAxesMap.get( + new Integer(index)); + if (axisIndices != null) { + // the first axis in the list is used for data <--> Java2D + Integer axisIndex = (Integer) axisIndices.get(0); + axis = getRangeAxis(axisIndex.intValue()); + } + else { + axis = getRangeAxis(0); + } + return axis; } /** @@ -3821,21 +3916,22 @@ * @since 1.0.3 */ private List datasetsMappedToDomainAxis(int axisIndex) { + Integer key = new Integer(axisIndex); List result = new ArrayList(); - for (int datasetIndex = 0; datasetIndex < this.datasets.size(); - datasetIndex++) { - Object dataset = this.datasets.get(datasetIndex); - if (dataset != null) { - Integer m = (Integer) this.datasetToDomainAxisMap.get( - datasetIndex); - if (m == null) { // a dataset with no mapping is assigned to - // axis 0 - if (axisIndex == 0) { + for (int i = 0; i < this.datasets.size(); i++) { + List mappedAxes = (List) this.datasetToDomainAxesMap.get( + new Integer(i)); + CategoryDataset dataset = (CategoryDataset) this.datasets.get(i); + if (mappedAxes == null) { + if (key.equals(ZERO)) { + if (dataset != null) { result.add(dataset); } } - else { - if (m.intValue() == axisIndex) { + } + else { + if (mappedAxes.contains(key)) { + if (dataset != null) { result.add(dataset); } } @@ -3853,21 +3949,19 @@ * @return A list of datasets. */ private List datasetsMappedToRangeAxis(int index) { + Integer key = new Integer(index); List result = new ArrayList(); for (int i = 0; i < this.datasets.size(); i++) { - Object dataset = this.datasets.get(i); - if (dataset != null) { - Integer m = (Integer) this.datasetToRangeAxisMap.get(i); - if (m == null) { // a dataset with no mapping is assigned to - // axis 0 - if (index == 0) { - result.add(dataset); - } + List mappedAxes = (List) this.datasetToRangeAxesMap.get( + new Integer(i)); + if (mappedAxes == null) { + if (key.equals(ZERO)) { + result.add(this.datasets.get(i)); } - else { - if (m.intValue() == index) { - result.add(dataset); - } + } + else { + if (mappedAxes.contains(key)) { + result.add(this.datasets.get(i)); } } } @@ -4262,12 +4356,12 @@ if (!this.rangeAxisLocations.equals(that.rangeAxisLocations)) { return false; } - if (!ObjectUtilities.equal(this.datasetToDomainAxisMap, - that.datasetToDomainAxisMap)) { + if (!ObjectUtilities.equal(this.datasetToDomainAxesMap, + that.datasetToDomainAxesMap)) { return false; } - if (!ObjectUtilities.equal(this.datasetToRangeAxisMap, - that.datasetToRangeAxisMap)) { + if (!ObjectUtilities.equal(this.datasetToRangeAxesMap, + that.datasetToRangeAxesMap)) { return false; } if (!ObjectUtilities.equal(this.renderers, that.renderers)) { @@ -4427,10 +4521,11 @@ dataset.addChangeListener(clone); } } - clone.datasetToDomainAxisMap - = (ObjectList) this.datasetToDomainAxisMap.clone(); - clone.datasetToRangeAxisMap - = (ObjectList) this.datasetToRangeAxisMap.clone(); + clone.datasetToDomainAxesMap = new TreeMap(); + clone.datasetToDomainAxesMap.putAll(this.datasetToDomainAxesMap); + clone.datasetToRangeAxesMap = new TreeMap(); + clone.datasetToRangeAxesMap.putAll(this.datasetToRangeAxesMap); + clone.renderers = (ObjectList) this.renderers.clone(); if (this.fixedDomainAxisSpace != null) { clone.fixedDomainAxisSpace = (AxisSpace) ObjectUtilities.clone( Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/XYPlot.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/XYPlot.java 2008-11-25 08:46:08 UTC (rev 1718) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/XYPlot.java 2008-11-25 09:11:27 UTC (rev 1719) @@ -44,6 +44,7 @@ * Richard West, Advanced Micro Devices, Inc.; * Ulrich Voigt - patch 1997549; * Peter Kolb - patch 1934255; + * Andrew Mickish - patch 1868749; * * Changes (from 21-Jun-2001) * -------------------------- @@ -208,7 +209,8 @@ * 25-Jul-2008 : Fixed NullPointerException for plots with no axes (DG); * 15-Aug-2008 : Added getRendererCount() method (DG); * 25-Sep-2008 : Added minor tick support, see patch 1934255 by Peter Kolb (DG); - * + * 25-Nov-2008 : Allow datasets to be mapped to multiple axes - based on patch + * 1868749 by Andrew Mickish (DG); */ package org.jfree.chart.plot; @@ -232,6 +234,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -247,9 +250,9 @@ import org.jfree.chart.axis.AxisLocation; import org.jfree.chart.axis.AxisSpace; import org.jfree.chart.axis.AxisState; +import org.jfree.chart.axis.TickType; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.axis.ValueTick; -import org.jfree.chart.axis.TickType; import org.jfree.chart.event.ChartChangeEventType; import org.jfree.chart.event.PlotChangeEvent; import org.jfree.chart.event.RendererChangeEvent; @@ -337,18 +340,24 @@ private ObjectList renderers; /** - * Storage for keys that map datasets/renderers to domain axes. If the - * map contains no entry for a dataset, it is assumed to map to the - * primary domain axis (index = 0). + * Storage for the mapping between datasets/renderers and domain axes. The + * keys in the map are Integer objects, corresponding to the dataset + * index. The values in the map are List objects containing Integer + * objects (corresponding to the axis indices). If the map contains no + * entry for a dataset, it is assumed to map to the primary domain axis + * (index = 0). */ - private Map datasetToDomainAxisMap; + private Map datasetToDomainAxesMap; /** - * Storage for keys that map datasets/renderers to range axes. If the - * map contains no entry for a dataset, it is assumed to map to the - * primary domain axis (index = 0). + * Storage for the mapping between datasets/renderers and range axes. The + * keys in the map are Integer objects, corresponding to the dataset + * index. The values in the map are List objects containing Integer + * objects (corresponding to the axis indices). If the map contains no + * entry for a dataset, it is assumed to map to the primary domain axis + * (index = 0). */ - private Map datasetToRangeAxisMap; + private Map datasetToRangeAxesMap; /** The origin point for the quadrants (if drawn). */ private transient Point2D quadrantOrigin = new Point2D.Double(0.0, 0.0); @@ -588,8 +597,8 @@ this.datasets = new ObjectList(); this.renderers = new ObjectList(); - this.datasetToDomainAxisMap = new TreeMap(); - this.datasetToRangeAxisMap = new TreeMap(); + this.datasetToDomainAxesMap = new TreeMap(); + this.datasetToRangeAxesMap = new TreeMap(); this.datasets.set(0, dataset); if (dataset != null) { @@ -1410,8 +1419,28 @@ * @see #mapDatasetToRangeAxis(int, int) */ public void mapDatasetToDomainAxis(int index, int axisIndex) { - this.datasetToDomainAxisMap.put(new Integer(index), - new Integer(axisIndex)); + List axisIndices = new java.util.ArrayList(1); + axisIndices.add(new Integer(axisIndex)); + mapDatasetToDomainAxes(index, axisIndices); + } + + /** + * Maps the specified dataset to the axes in the list. Note that the + * conversion of data values into Java2D space is always performed using + * the first axis in the list. + * + * @param index the dataset index (zero-based). + * @param axisIndices the axis indices (<code>null</code> permitted). + * + * @since 1.0.12 + */ + public void mapDatasetToDomainAxes(int index, List axisIndices) { + if (index < 0) { + throw new IllegalArgumentException("Requires 'index' >= 0."); + } + checkAxisIndices(axisIndices); + Integer key = new Integer(index); + this.datasetToDomainAxesMap.put(key, new ArrayList(axisIndices)); // fake a dataset change event to update axes... datasetChanged(new DatasetChangeEvent(this, getDataset(index))); } @@ -1426,13 +1455,65 @@ * @see #mapDatasetToDomainAxis(int, int) */ public void mapDatasetToRangeAxis(int index, int axisIndex) { - this.datasetToRangeAxisMap.put(new Integer(index), - new Integer(axisIndex)); + List axisIndices = new java.util.ArrayList(1); + axisIndices.add(new Integer(axisIndex)); + mapDatasetToRangeAxes(index, axisIndices); + } + + /** + * Maps the specified dataset to the axes in the list. Note that the + * conversion of data values into Java2D space is always performed using + * the first axis in the list. + * + * @param index the dataset index (zero-based). + * @param axisIndices the axis indices (<code>null</code> permitted). + * + * @since 1.0.12 + */ + public void mapDatasetToRangeAxes(int index, List axisIndices) { + if (index < 0) { + throw new IllegalArgumentException("Requires 'index' >= 0."); + } + checkAxisIndices(axisIndices); + Integer key = new Integer(index); + this.datasetToRangeAxesMap.put(key, new ArrayList(axisIndices)); // fake a dataset change event to update axes... datasetChanged(new DatasetChangeEvent(this, getDataset(index))); } /** + * This method is used to perform argument checking on the list of + * axis indices passed to mapDatasetToDomainAxes() and + * mapDatasetToRangeAxes(). + * + * @param indices the list of indices (<code>null</code> permitted). + */ + private void checkAxisIndices(List indices) { + // axisIndices can be: + // 1. null; + // 2. non-empty, containing only Integer objects that are unique. + if (indices == null) { + return; // OK + } + int count = indices.size(); + if (count == 0) { + throw new IllegalArgumentException("Empty list not permitted."); + } + HashSet set = new HashSet(); + for (int i = 0; i < count; i++) { + Object item = indices.get(i); + if (!(item instanceof Integer)) { + throw new IllegalArgumentException( + "Indices must be Integer instances."); + } + if (set.contains(item)) { + throw new IllegalArgumentException("Indices must be unique."); + } + set.add(item); + } + } + + /** * Returns the number of renderer slots for this plot. * * @return The number of renderer slots. @@ -3676,23 +3757,23 @@ * @return The axis. */ public ValueAxis getDomainAxisForDataset(int index) { - - if (index < 0 || index >= getDatasetCount()) { + int upper = Math.max(getDatasetCount(), getRendererCount()); + if (index < 0 || index >= upper) { throw new IllegalArgumentException("Index " + index + " out of bounds."); } - ValueAxis valueAxis = null; - Integer axisIndex = (Integer) this.datasetToDomainAxisMap.get( + List axisIndices = (List) this.datasetToDomainAxesMap.get( new Integer(index)); - if (axisIndex != null) { + if (axisIndices != null) { + // the first axis in the list is used for data <--> Java2D + Integer axisIndex = (Integer) axisIndices.get(0); valueAxis = getDomainAxis(axisIndex.intValue()); } else { valueAxis = getDomainAxis(0); } return valueAxis; - } /** @@ -3703,23 +3784,23 @@ * @return The axis. */ public ValueAxis getRangeAxisForDataset(int index) { - - if (index < 0 || index >= getDatasetCount()) { + int upper = Math.max(getDatasetCount(), getRendererCount()); + if (index < 0 || index >= upper) { throw new IllegalArgumentException("Index " + index + " out of bounds."); } - ValueAxis valueAxis = null; - Integer axisIndex - = (Integer) this.datasetToRangeAxisMap.get(new Integer(index)); - if (axisIndex != null) { + List axisIndices = (List) this.datasetToRangeAxesMap.get( + new Integer(index)); + if (axisIndices != null) { + // the first axis in the list is used for data <--> Java2D + Integer axisIndex = (Integer) axisIndices.get(0); valueAxis = getRangeAxis(axisIndex.intValue()); } else { valueAxis = getRangeAxis(0); } return valueAxis; - } /** @@ -3793,7 +3874,7 @@ ValueAxis axis = getRangeAxis(); if (axis != null) { Iterator iterator = ticks.iterator(); - boolean paintLine = false; + boolean paintLine = false; while (iterator.hasNext()) { paintLine = false; ValueTick tick = (ValueTick) iterator.next(); @@ -3807,8 +3888,8 @@ gridPaint = getRangeGridlinePaint(); paintLine = true; } - if (tick.getValue() != 0.0 - || !isRangeZeroBaselineVisible() && (paintLine)) { + if ((tick.getValue() != 0.0 + || !isRangeZeroBaselineVisible()) && paintLine) { getRenderer().drawRangeLine(g2, this, getRangeAxis(), area, tick.getValue(), gridPaint, gridStroke); } @@ -4197,15 +4278,15 @@ } List result = new ArrayList(); for (int i = 0; i < this.datasets.size(); i++) { - Integer mappedAxis = (Integer) this.datasetToDomainAxisMap.get( + List mappedAxes = (List) this.datasetToDomainAxesMap.get( new Integer(i)); - if (mappedAxis == null) { + if (mappedAxes == null) { if (axisIndex.equals(ZERO)) { result.add(this.datasets.get(i)); } } else { - if (mappedAxis.equals(axisIndex)) { + if (mappedAxes.contains(axisIndex)) { result.add(this.datasets.get(i)); } } @@ -4227,15 +4308,15 @@ } List result = new ArrayList(); for (int i = 0; i < this.datasets.size(); i++) { - Integer mappedAxis = (Integer) this.datasetToRangeAxisMap.get( + List mappedAxes = (List) this.datasetToRangeAxesMap.get( new Integer(i)); - if (mappedAxis == null) { + if (mappedAxes == null) { if (axisIndex.equals(ZERO)) { result.add(this.datasets.get(i)); } } else { - if (mappedAxis.equals(axisIndex)) { + if (mappedAxes.contains(axisIndex)) { result.add(this.datasets.get(i)); } } @@ -5097,12 +5178,12 @@ if (!this.rangeAxisLocations.equals(that.rangeAxisLocations)) { return false; } - if (!ObjectUtilities.equal(this.datasetToDomainAxisMap, - that.datasetToDomainAxisMap)) { + if (!ObjectUtilities.equal(this.datasetToDomainAxesMap, + that.datasetToDomainAxesMap)) { return false; } - if (!ObjectUtilities.equal(this.datasetToRangeAxisMap, - that.datasetToRangeAxisMap)) { + if (!ObjectUtilities.equal(this.datasetToRangeAxesMap, + that.datasetToRangeAxesMap)) { return false; } if (!ObjectUtilities.equal(this.domainGridlineStroke, @@ -5270,10 +5351,10 @@ } } - clone.datasetToDomainAxisMap = new TreeMap(); - clone.datasetToDomainAxisMap.putAll(this.datasetToDomainAxisMap); - clone.datasetToRangeAxisMap = new TreeMap(); - clone.datasetToRangeAxisMap.putAll(this.datasetToRangeAxisMap); + clone.datasetToDomainAxesMap = new TreeMap(); + clone.datasetToDomainAxesMap.putAll(this.datasetToDomainAxesMap); + clone.datasetToRangeAxesMap = new TreeMap(); + clone.datasetToRangeAxesMap.putAll(this.datasetToRangeAxesMap); clone.renderers = (ObjectList) ObjectUtilities.clone(this.renderers); for (int i = 0; i < this.renderers.size(); i++) { Modified: branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/CategoryPlotTests.java =================================================================== --- branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/CategoryPlotTests.java 2008-11-25 08:46:08 UTC (rev 1718) +++ branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/CategoryPlotTests.java 2008-11-25 09:11:27 UTC (rev 1719) @@ -92,8 +92,10 @@ import org.jfree.chart.renderer.category.AreaRenderer; import org.jfree.chart.renderer.category.BarRenderer; import org.jfree.chart.renderer.category.CategoryItemRenderer; +import org.jfree.chart.renderer.category.DefaultCategoryItemRenderer; import org.jfree.chart.renderer.category.LineAndShapeRenderer; import org.jfree.data.Range; +import org.jfree.data.category.CategoryDataset; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.ui.Layer; import org.jfree.ui.RectangleInsets; @@ -930,4 +932,87 @@ assertFalse(plot.removeRangeMarker(new ValueMarker(0.5))); } + /** + * Some tests for the getDomainAxisForDataset() method. + */ + public void testGetDomainAxisForDataset() { + CategoryDataset dataset = new DefaultCategoryDataset(); + CategoryAxis xAxis = new CategoryAxis("X"); + NumberAxis yAxis = new NumberAxis("Y"); + CategoryItemRenderer renderer = new BarRenderer(); + CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); + assertEquals(xAxis, plot.getDomainAxisForDataset(0)); + + // should get IllegalArgumentException for negative index + boolean pass = false; + try { + plot.getDomainAxisForDataset(-1); + } + catch (IllegalArgumentException e) { + pass = true; + } + assertTrue(pass); + + // if multiple axes are mapped, the first in the list should be + // returned... + CategoryAxis xAxis2 = new CategoryAxis("X2"); + plot.setDomainAxis(1, xAxis2); + assertEquals(xAxis, plot.getDomainAxisForDataset(0)); + + plot.mapDatasetToDomainAxis(0, 1); + assertEquals(xAxis2, plot.getDomainAxisForDataset(0)); + + List axisIndices = Arrays.asList(new Integer[] {new Integer(0), + new Integer(1)}); + plot.mapDatasetToDomainAxes(0, axisIndices); + assertEquals(xAxis, plot.getDomainAxisForDataset(0)); + + axisIndices = Arrays.asList(new Integer[] {new Integer(1), + new Integer(2)}); + plot.mapDatasetToDomainAxes(0, axisIndices); + assertEquals(xAxis2, plot.getDomainAxisForDataset(0)); + } + + /** + * Some tests for the getRangeAxisForDataset() method. + */ + public void testGetRangeAxisForDataset() { + CategoryDataset dataset = new DefaultCategoryDataset(); + CategoryAxis xAxis = new CategoryAxis("X"); + NumberAxis yAxis = new NumberAxis("Y"); + CategoryItemRenderer renderer = new DefaultCategoryItemRenderer(); + CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); + assertEquals(yAxis, plot.getRangeAxisForDataset(0)); + + // should get IllegalArgumentException for negative index + boolean pass = false; + try { + plot.getRangeAxisForDataset(-1); + } + catch (IllegalArgumentException e) { + pass = true; + } + assertTrue(pass); + + // if multiple axes are mapped, the first in the list should be + // returned... + NumberAxis yAxis2 = new NumberAxis("Y2"); + plot.setRangeAxis(1, yAxis2); + assertEquals(yAxis, plot.getRangeAxisForDataset(0)); + + plot.mapDatasetToRangeAxis(0, 1); + assertEquals(yAxis2, plot.getRangeAxisForDataset(0)); + + List axisIndices = Arrays.asList(new Integer[] {new Integer(0), + new Integer(1)}); + plot.mapDatasetToRangeAxes(0, axisIndices); + assertEquals(yAxis, plot.getRangeAxisForDataset(0)); + + axisIndices = Arrays.asList(new Integer[] {new Integer(1), + new Integer(2)}); + plot.mapDatasetToRangeAxes(0, axisIndices); + assertEquals(yAxis2, plot.getRangeAxisForDataset(0)); + } + + } Modified: branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/XYPlotTests.java =================================================================== --- branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/XYPlotTests.java 2008-11-25 08:46:08 UTC (rev 1718) +++ branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/XYPlotTests.java 2008-11-25 09:11:27 UTC (rev 1719) @@ -416,6 +416,17 @@ plot2.setRangeMinorGridlineStroke(new BasicStroke(1.23f)); assertTrue(plot1.equals(plot2)); + List axisIndices = Arrays.asList(new Integer[] {new Integer(0), + new Integer(1)}); + plot1.mapDatasetToDomainAxes(0, axisIndices); + assertFalse(plot1.equals(plot2)); + plot2.mapDatasetToDomainAxes(0, axisIndices); + assertTrue(plot1.equals(plot2)); + + plot1.mapDatasetToRangeAxes(0, axisIndices); + assertFalse(plot1.equals(plot2)); + plot2.mapDatasetToRangeAxes(0, axisIndices); + assertTrue(plot1.equals(plot2)); } /** @@ -442,6 +453,10 @@ XYPlot p1 = new XYPlot(null, new NumberAxis("Domain Axis"), new NumberAxis("Range Axis"), new StandardXYItemRenderer()); p1.setRangeAxis(1, new NumberAxis("Range Axis 2")); + List axisIndices = Arrays.asList(new Integer[] {new Integer(0), + new Integer(1)}); + p1.mapDatasetToDomainAxes(0, axisIndices); + p1.mapDatasetToRangeAxes(0, axisIndices); p1.setRenderer(1, new XYBarRenderer()); XYPlot p2 = null; try { @@ -608,9 +623,8 @@ out.writeObject(p1); out.close(); - ObjectInput in = new ObjectInputStream( - new ByteArrayInputStream(buffer.toByteArray()) - ); + ObjectInput in = new ObjectInputStream(new ByteArrayInputStream( + buffer.toByteArray())); p2 = (XYPlot) in.readObject(); in.close(); } @@ -629,7 +643,7 @@ IntervalXYDataset data1 = createDataset1(); XYItemRenderer renderer1 = new XYBarRenderer(0.20); - renderer1.setToolTipGenerator( + renderer1.setBaseToolTipGenerator( StandardXYToolTipGenerator.getTimeSeriesInstance()); XYPlot p1 = new XYPlot(data1, new DateAxis("Date"), null, renderer1); XYPlot p2 = null; @@ -1066,4 +1080,105 @@ assertFalse(plot.removeRangeMarker(new ValueMarker(0.5))); } + /** + * Some tests for the getDomainAxisForDataset() method. + */ + public void testGetDomainAxisForDataset() { + XYDataset dataset = new XYSeriesCollection(); + NumberAxis xAxis = new NumberAxis("X"); + NumberAxis yAxis = new NumberAxis("Y"); + XYItemRenderer renderer = new DefaultXYItemRenderer(); + XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); + assertEquals(xAxis, plot.getDomainAxisForDataset(0)); + + // should get IllegalArgumentException for negative index + boolean pass = false; + try { + plot.getDomainAxisForDataset(-1); + } + catch (IllegalArgumentException e) { + pass = true; + } + assertTrue(pass); + + // should get IllegalArgumentException for index too high + pass = false; + try { + plot.getDomainAxisForDataset(1); + } + catch (IllegalArgumentException e) { + pass = true; + } + assertTrue(pass); + + // if multiple axes are mapped, the first in the list should be + // returned... + NumberAxis xAxis2 = new NumberAxis("X2"); + plot.setDomainAxis(1, xAxis2); + assertEquals(xAxis, plot.getDomainAxisForDataset(0)); + + plot.mapDatasetToDomainAxis(0, 1); + assertEquals(xAxis2, plot.getDomainAxisForDataset(0)); + + List axisIndices = Arrays.asList(new Integer[] {new Integer(0), + new Integer(1)}); + plot.mapDatasetToDomainAxes(0, axisIndices); + assertEquals(xAxis, plot.getDomainAxisForDataset(0)); + + axisIndices = Arrays.asList(new Integer[] {new Integer(1), + new Integer(2)}); + plot.mapDatasetToDomainAxes(0, axisIndices); + assertEquals(xAxis2, plot.getDomainAxisForDataset(0)); + } + + /** + * Some tests for the getRangeAxisForDataset() method. + */ + public void testGetRangeAxisForDataset() { + XYDataset dataset = new XYSeriesCollection(); + NumberAxis xAxis = new NumberAxis("X"); + NumberAxis yAxis = new NumberAxis("Y"); + XYItemRenderer renderer = new DefaultXYItemRenderer(); + XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); + assertEquals(yAxis, plot.getRangeAxisForDataset(0)); + + // should get IllegalArgumentException for negative index + boolean pass = false; + try { + plot.getRangeAxisForDataset(-1); + } + catch (IllegalArgumentException e) { + pass = true; + } + assertTrue(pass); + + // should get IllegalArgumentException for index too high + pass = false; + try { + plot.getRangeAxisForDataset(1); + } + catch (IllegalArgumentException e) { + pass = true; + } + assertTrue(pass); + + // if multiple axes are mapped, the first in the list should be + // returned... + NumberAxis yAxis2 = new NumberAxis("Y2"); + plot.setRangeAxis(1, yAxis2); + assertEquals(yAxis, plot.getRangeAxisForDataset(0)); + + plot.mapDatasetToRangeAxis(0, 1); + assertEquals(yAxis2, plot.getRangeAxisForDataset(0)); + + List axisIndices = Arrays.asList(new Integer[] {new Integer(0), + new Integer(1)}); + plot.mapDatasetToRangeAxes(0, axisIndices); + assertEquals(yAxis, plot.getRangeAxisForDataset(0)); + + axisIndices = Arrays.asList(new Integer[] {new Integer(1), + new Integer(2)}); + plot.mapDatasetToRangeAxes(0, axisIndices); + assertEquals(yAxis2, plot.getRangeAxisForDataset(0)); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-11-25 15:59:01
|
Revision: 1724 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1724&view=rev Author: mungady Date: 2008-11-25 15:58:57 +0000 (Tue, 25 Nov 2008) Log Message: ----------- 2008-11-25 David Gilbert <dav...@ob...> Bug fix 2201869 by Fawad Halim (with modifications): * source/org/jfree/chart/axis/DateAxis.java (previousStandardDate): Use new Month constructor, (correctTickDateForPosition): New private method, (refreshTicksHorizontal): Moved position correction to top of loop, (refreshTicksVertical): Likewise, * source/org/jfree/data/time/Month.java (Month(Date, TimeZone)): Deprecated, (Month(Date, TimeZone, Locale)): New constructor, * source/org/jfree/data/time/Quarter.java (Quarter(Date, TimeZone)): Deprecated, (Quarter(Date, TimeZone, Locale)): New constructor, * source/org/jfree/data/time/Year.java (Year(Date, TimeZone)): Deprecated, (Year(Date, TimeZone, Locale)): New constructor. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/DateAxis.java branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Month.java branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Quarter.java branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Year.java branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/axis/junit/DateAxisTests.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2008-11-25 10:21:44 UTC (rev 1723) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2008-11-25 15:58:57 UTC (rev 1724) @@ -1,5 +1,23 @@ 2008-11-25 David Gilbert <dav...@ob...> + Bug fix 2201869 by Fawad Halim (with modifications): + * source/org/jfree/chart/axis/DateAxis.java + (previousStandardDate): Use new Month constructor, + (correctTickDateForPosition): New private method, + (refreshTicksHorizontal): Moved position correction to top of loop, + (refreshTicksVertical): Likewise, + * source/org/jfree/data/time/Month.java + (Month(Date, TimeZone)): Deprecated, + (Month(Date, TimeZone, Locale)): New constructor, + * source/org/jfree/data/time/Quarter.java + (Quarter(Date, TimeZone)): Deprecated, + (Quarter(Date, TimeZone, Locale)): New constructor, + * source/org/jfree/data/time/Year.java + (Year(Date, TimeZone)): Deprecated, + (Year(Date, TimeZone, Locale)): New constructor. + +2008-11-25 David Gilbert <dav...@ob...> + Based on patch 1868749 by Andrew Mickish: * source/org/jfree/chart/plot/CategoryPlot.java (datasetToDomainAxisMap): Changed from ObjectList to TreeMap, Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/DateAxis.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/DateAxis.java 2008-11-25 10:21:44 UTC (rev 1723) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/axis/DateAxis.java 2008-11-25 15:58:57 UTC (rev 1724) @@ -38,6 +38,7 @@ * Chris Boek; * Peter Kolb (patch 1934255); * Andrew Mickish (patch 1870189); + * Fawad Halim (bug 2201869); * * Changes (from 23-Jun-2001) * -------------------------- @@ -121,6 +122,7 @@ * 2078057 (DG); * 18-Sep-2008 : Added locale to go with timezone (DG); * 25-Sep-2008 : Added minor tick support, see patch 1934255 by Peter Kolb (DG); + * 25-Nov-2008 : Added bug fix 2201869 by Fawad Halim (DG); * */ @@ -1002,8 +1004,8 @@ years = calendar.get(Calendar.YEAR); calendar.clear(Calendar.MILLISECOND); calendar.set(years, value, 1, 0, 0, 0); - // FIXME: the following month needs a locale - Month month = new Month(calendar.getTime(), this.timeZone); + Month month = new Month(calendar.getTime(), this.timeZone, + this.locale); Date standardDate = calculateDateForPosition( month, this.tickMarkPosition); long millis = standardDate.getTime(); @@ -1559,6 +1561,39 @@ } /** + * Corrects the given tick date for the position setting. + * + * @param time the tick date/time. + * @param unit the tick unit. + * @param position the tick position. + * + * @return The adjusted time. + */ + private Date correctTickDateForPosition(Date time, DateTickUnit unit, + DateTickMarkPosition position) { + Date result = time; + switch (unit.getUnit()) { + case (DateTickUnit.MILLISECOND) : + case (DateTickUnit.SECOND) : + case (DateTickUnit.MINUTE) : + case (DateTickUnit.HOUR) : + case (DateTickUnit.DAY) : + break; + case (DateTickUnit.MONTH) : + result = calculateDateForPosition(new Month(time, + this.timeZone, this.locale), position); + break; + case(DateTickUnit.YEAR) : + result = calculateDateForPosition(new Year(time, + this.timeZone, this.locale), position); + break; + + default: break; + } + return result; + } + + /** * Recalculates the ticks for the date axis. * * @param g2 the graphics device. @@ -1584,6 +1619,10 @@ Date upperDate = getMaximumDate(); while (tickDate.before(upperDate)) { + // could add a flag to make the following correction optional... + tickDate = correctTickDateForPosition(tickDate, unit, + this.tickMarkPosition); + long lowestTickTime = tickDate.getTime(); long distance = unit.addToDate(tickDate, this.timeZone).getTime() - lowestTickTime; @@ -1660,30 +1699,6 @@ continue; } - // could add a flag to make the following correction optional... - switch (unit.getUnit()) { - - case (DateTickUnit.MILLISECOND) : - case (DateTickUnit.SECOND) : - case (DateTickUnit.MINUTE) : - case (DateTickUnit.HOUR) : - case (DateTickUnit.DAY) : - break; - case (DateTickUnit.MONTH) : - // FIXME: the following month needs a locale - tickDate = calculateDateForPosition(new Month(tickDate, - this.timeZone), this.tickMarkPosition); - break; - case(DateTickUnit.YEAR) : - // FIXME: the following year needs a locale - tickDate = calculateDateForPosition(new Year(tickDate, - this.timeZone), this.tickMarkPosition); - break; - - default: break; - - } - } return result; @@ -1711,10 +1726,14 @@ } DateTickUnit unit = getTickUnit(); Date tickDate = calculateLowestVisibleTickValue(unit); - //Date upperDate = calculateHighestVisibleTickValue(unit); Date upperDate = getMaximumDate(); + while (tickDate.before(upperDate)) { + // could add a flag to make the following correction optional... + tickDate = correctTickDateForPosition(tickDate, unit, + this.tickMarkPosition); + long lowestTickTime = tickDate.getTime(); long distance = unit.addToDate(tickDate, this.timeZone).getTime() - lowestTickTime; Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Month.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Month.java 2008-11-25 10:21:44 UTC (rev 1723) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Month.java 2008-11-25 15:58:57 UTC (rev 1724) @@ -58,6 +58,7 @@ * 01-Sep-2008 : Added clarification for previous() and next() methods (DG); * 16-Sep-2008 : Deprecated DEFAULT_TIME_ZONE, and updated parsing to handle * extended range in Year (DG); + * 25-Nov-2008 : Added new constructor with Locale (DG); * */ @@ -66,6 +67,7 @@ import java.io.Serializable; import java.util.Calendar; import java.util.Date; +import java.util.Locale; import java.util.TimeZone; import org.jfree.date.MonthConstants; @@ -148,9 +150,25 @@ * * @param time the date/time. * @param zone the time zone (<code>null</code> not permitted). + * + * @deprecated Since 1.0.12, use {@link #Month(Date, TimeZone, Locale)} + * instead. */ public Month(Date time, TimeZone zone) { - // FIXME: need a locale as well as a timezone + this(time, zone, Locale.getDefault()); + } + + /** + * Creates a new <code>Month</code> instance, based on the specified time, + * zone and locale. + * + * @param time the current time. + * @param zone the time zone. + * @param locale the locale. + * + * @since 1.0.12 + */ + public Month(Date time, TimeZone zone, Locale locale) { Calendar calendar = Calendar.getInstance(zone); calendar.setTime(time); this.month = calendar.get(Calendar.MONTH) + 1; Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Quarter.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Quarter.java 2008-11-25 10:21:44 UTC (rev 1723) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Quarter.java 2008-11-25 15:58:57 UTC (rev 1724) @@ -54,6 +54,7 @@ * 05-Oct-2006 : Updated API docs (DG); * 06-Oct-2006 : Refactored to cache first and last millisecond values (DG); * 16-Sep-2008 : Deprecated DEFAULT_TIME_ZONE (DG); + * 25-Nov-2008 : Added new constructor with Locale (DG); * */ @@ -62,6 +63,7 @@ import java.io.Serializable; import java.util.Calendar; import java.util.Date; +import java.util.Locale; import java.util.TimeZone; import org.jfree.date.MonthConstants; @@ -161,10 +163,26 @@ * * @param time the date/time. * @param zone the zone (<code>null</code> not permitted). + * + * @deprecated Since 1.0.12, use {@link #Quarter(Date, TimeZone, Locale)} + * instead. */ public Quarter(Date time, TimeZone zone) { - // FIXME: need a locale as well as a timezone - Calendar calendar = Calendar.getInstance(zone); + this(time, zone, Locale.getDefault()); + } + + /** + * Creates a new <code>Quarter</code> instance, using the specified + * zone and locale. + * + * @param time the current time. + * @param zone the time zone. + * @param locale the locale. + * + * @since 1.0.12 + */ + public Quarter(Date time, TimeZone zone, Locale locale) { + Calendar calendar = Calendar.getInstance(zone, locale); calendar.setTime(time); int month = calendar.get(Calendar.MONTH) + 1; this.quarter = (byte) SerialDate.monthCodeToQuarter(month); Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Year.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Year.java 2008-11-25 10:21:44 UTC (rev 1723) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/data/time/Year.java 2008-11-25 15:58:57 UTC (rev 1724) @@ -53,8 +53,9 @@ * ------------- JFREECHART 1.0.x --------------------------------------------- * 05-Oct-2006 : Updated API docs (DG); * 06-Oct-2006 : Refactored to cache first and last millisecond values (DG); - * 16-Sep-2008 : Extended range of valid years, and deprecated + * 16-Sep-2008 : Extended range of valid years, and deprecated * DEFAULT_TIME_ZONE (DG); + * 25-Nov-2008 : Added new constructor with Locale (DG); * */ @@ -63,6 +64,7 @@ import java.io.Serializable; import java.util.Calendar; import java.util.Date; +import java.util.Locale; import java.util.TimeZone; /** @@ -133,12 +135,28 @@ /** * Constructs a year, based on a particular instant in time and a time zone. * - * @param time the time. + * @param time the time (<code>null</code> not permitted). * @param zone the time zone. + * + * @deprecated Since 1.0.12, use {@link #Year(Date, TimeZone, Locale)} + * instead. */ public Year(Date time, TimeZone zone) { - // FIXME: needs a locale as well as a timezone - Calendar calendar = Calendar.getInstance(zone); + this(time, zone, Locale.getDefault()); + } + + /** + * Creates a new <code>Year</code> instance, for the specified time zone + * and locale. + * + * @param time the current time (<code>null</code> not permitted). + * @param zone the time zone. + * @param locale the locale. + * + * @since 1.0.12 + */ + public Year(Date time, TimeZone zone, Locale locale) { + Calendar calendar = Calendar.getInstance(zone, locale); calendar.setTime(time); this.year = (short) calendar.get(Calendar.YEAR); peg(calendar); Modified: branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/axis/junit/DateAxisTests.java =================================================================== --- branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/axis/junit/DateAxisTests.java 2008-11-25 10:21:44 UTC (rev 1723) +++ branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/axis/junit/DateAxisTests.java 2008-11-25 15:58:57 UTC (rev 1724) @@ -42,12 +42,15 @@ * 03-May-2007 : Replaced the tests for the previousStandardDate() method with * new tests that check that the previousStandardDate and the * next standard date do in fact span the reference date (DG); + * 25-Nov-2008 : Added testBug2201869 (DG); * */ package org.jfree.chart.axis.junit; +import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInput; @@ -55,14 +58,21 @@ import java.io.ObjectOutput; import java.io.ObjectOutputStream; import java.text.SimpleDateFormat; +import java.util.Arrays; import java.util.Calendar; import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; +import java.util.Locale; +import java.util.TimeZone; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jfree.chart.axis.AxisState; import org.jfree.chart.axis.DateAxis; +import org.jfree.chart.axis.DateTick; import org.jfree.chart.axis.DateTickMarkPosition; import org.jfree.chart.axis.DateTickUnit; import org.jfree.chart.axis.SegmentedTimeline; @@ -1135,4 +1145,49 @@ assertTrue(nsd.getTime() >= d0.getTime()); } + /** + * A test to reproduce bug 2201869. + */ + public void testBug2201869() { + TimeZone tz = TimeZone.getTimeZone("GMT"); + GregorianCalendar c = new GregorianCalendar(tz, Locale.UK); + DateAxis axis = new DateAxis("Date", tz, Locale.UK); + SimpleDateFormat sdf = new SimpleDateFormat("d-MMM-yyyy", Locale.UK); + sdf.setCalendar(c); + axis.setTickUnit(new DateTickUnit(DateTickUnit.MONTH, 1, sdf)); + Day d1 = new Day(1, 3, 2008); + d1.peg(c); + Day d2 = new Day(30, 6, 2008); + d2.peg(c); + axis.setRange(d1.getStart(), d2.getEnd()); + BufferedImage image = new BufferedImage(200, 100, + BufferedImage.TYPE_INT_ARGB); + Graphics2D g2 = image.createGraphics(); + Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, 200, 100); + axis.setTickMarkPosition(DateTickMarkPosition.END); + List ticks = axis.refreshTicks(g2, new AxisState(), area, + RectangleEdge.BOTTOM); + System.out.println(ticks); + assertEquals(3, ticks.size()); + DateTick t1 = (DateTick) ticks.get(0); + assertEquals("31-Mar-2008", t1.getText()); + DateTick t2 = (DateTick) ticks.get(1); + assertEquals("30-Apr-2008", t2.getText()); + DateTick t3 = (DateTick) ticks.get(2); + assertEquals("31-May-2008", t3.getText()); + + // now repeat for a vertical axis + ticks = axis.refreshTicks(g2, new AxisState(), area, + RectangleEdge.LEFT); + System.out.println(ticks); + assertEquals(3, ticks.size()); + t1 = (DateTick) ticks.get(0); + assertEquals("31-Mar-2008", t1.getText()); + t2 = (DateTick) ticks.get(1); + assertEquals("30-Apr-2008", t2.getText()); + t3 = (DateTick) ticks.get(2); + assertEquals("31-May-2008", t3.getText()); + System.out.println(Arrays.asList(Calendar.getAvailableLocales())); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-12-03 08:35:09
|
Revision: 1732 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1732&view=rev Author: mungady Date: 2008-12-03 08:35:07 +0000 (Wed, 03 Dec 2008) Log Message: ----------- 2008-12-03 David Gilbert <dav...@ob...> * source/org/jfree/chart/block/GridArrangement.java (arrange): Fill in missing constraint combinations, (arrangeNN): Check for null block, (arrangeFF): Likewise, (arrangeRF): New method, (arrangeRN): Likewise, (arrangeNR): Likewise, (arrangeRR): Likewise, (arrangeFN): Check for null block, (arrangeNF): New method, * tests/org/jfree/chart/block/junit/GridArrangementTests.java: Added various new tests. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/block/GridArrangement.java branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/block/junit/GridArrangementTests.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2008-12-03 08:31:33 UTC (rev 1731) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2008-12-03 08:35:07 UTC (rev 1732) @@ -1,3 +1,18 @@ +2008-12-03 David Gilbert <dav...@ob...> + + * source/org/jfree/chart/block/GridArrangement.java + (arrange): Fill in missing constraint combinations, + (arrangeNN): Check for null block, + (arrangeFF): Likewise, + (arrangeRF): New method, + (arrangeRN): Likewise, + (arrangeNR): Likewise, + (arrangeRR): Likewise, + (arrangeFN): Check for null block, + (arrangeNF): New method, + * tests/org/jfree/chart/block/junit/GridArrangementTests.java: + Added various new tests. + 2008-11-25 David Gilbert <dav...@ob...> Bug fix 2201869 by Fawad Halim (with modifications): Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/block/GridArrangement.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/block/GridArrangement.java 2008-12-03 08:31:33 UTC (rev 1731) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/block/GridArrangement.java 2008-12-03 08:35:07 UTC (rev 1732) @@ -35,6 +35,8 @@ * Changes: * -------- * 08-Feb-2005 : Version 1 (DG); + * 03-Dec-2008 : Implemented missing methods, and fixed bugs reported in + * patch 2370487 (DG); * */ @@ -90,7 +92,7 @@ * Arranges the blocks within the specified container, subject to the given * constraint. * - * @param container the container. + * @param container the container (<code>null</code> not permitted). * @param constraint the constraint. * @param g2 the graphics device. * @@ -105,12 +107,11 @@ return arrangeNN(container, g2); } else if (h == LengthConstraintType.FIXED) { - - throw new RuntimeException("Not yet implemented."); + return arrangeNF(container, g2, constraint); } else if (h == LengthConstraintType.RANGE) { // find optimum height, then map to range - throw new RuntimeException("Not yet implemented."); + return arrangeNR(container, g2, constraint); } } else if (w == LengthConstraintType.FIXED) { @@ -130,23 +131,23 @@ // find optimum width and map to range if (h == LengthConstraintType.NONE) { // find optimum height - throw new RuntimeException("Not yet implemented."); + return arrangeRN(container, g2, constraint); } else if (h == LengthConstraintType.FIXED) { // fixed width - throw new RuntimeException("Not yet implemented."); + return arrangeRF(container, g2, constraint); } else if (h == LengthConstraintType.RANGE) { - throw new RuntimeException("Not yet implemented."); + return arrangeRR(container, g2, constraint); } } - return new Size2D(); // TODO: complete this + throw new RuntimeException("Should never get to here!"); } /** * Arranges the container with no constraint on the width or height. * - * @param container the container. + * @param container the container (<code>null</code> not permitted). * @param g2 the graphics device. * * @return The size. @@ -158,9 +159,11 @@ Iterator iterator = blocks.iterator(); while (iterator.hasNext()) { Block b = (Block) iterator.next(); - Size2D s = b.arrange(g2, RectangleConstraint.NONE); - maxW = Math.max(maxW, s.width); - maxH = Math.max(maxH, s.height); + if (b != null) { + Size2D s = b.arrange(g2, RectangleConstraint.NONE); + maxW = Math.max(maxW, s.width); + maxH = Math.max(maxH, s.height); + } } double width = this.columns * maxW; double height = this.rows * maxH; @@ -171,27 +174,28 @@ /** * Arranges the container with a fixed overall width and height. * - * @param container the container. + * @param container the container (<code>null</code> not permitted). * @param g2 the graphics device. - * @param constraint the constraint. + * @param constraint the constraint (<code>null</code> not permitted). * * @return The size following the arrangement. */ protected Size2D arrangeFF(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { - double width = constraint.getWidth() / this.columns; + double width = constraint.getWidth() / this.columns; double height = constraint.getHeight() / this.rows; List blocks = container.getBlocks(); for (int c = 0; c < this.columns; c++) { for (int r = 0; r < this.rows; r++) { int index = r * this.columns + c; - if (index == blocks.size()) { + if (index >= blocks.size()) { break; } Block b = (Block) blocks.get(index); - b.setBounds(new Rectangle2D.Double( - c * width, r * height, width, height - )); + if (b != null) { + b.setBounds(new Rectangle2D.Double(c * width, r * height, + width, height)); + } } } return new Size2D(this.columns * width, this.rows * height); @@ -223,6 +227,129 @@ } /** + * Arrange with a fixed height and a width within a given range. + * + * @param container the container. + * @param constraint the constraint. + * @param g2 the graphics device. + * + * @return The size of the arrangement. + */ + protected Size2D arrangeRF(BlockContainer container, Graphics2D g2, + RectangleConstraint constraint) { + + RectangleConstraint c1 = constraint.toUnconstrainedWidth(); + Size2D size1 = arrange(container, g2, c1); + + if (constraint.getWidthRange().contains(size1.getWidth())) { + return size1; + } + else { + double w = constraint.getWidthRange().constrain(size1.getWidth()); + RectangleConstraint c2 = constraint.toFixedWidth(w); + return arrange(container, g2, c2); + } + } + + /** + * Arrange with a fixed width and no height constraint. + * + * @param container the container. + * @param constraint the constraint. + * @param g2 the graphics device. + * + * @return The size of the arrangement. + */ + protected Size2D arrangeRN(BlockContainer container, Graphics2D g2, + RectangleConstraint constraint) { + + RectangleConstraint c1 = constraint.toUnconstrainedWidth(); + Size2D size1 = arrange(container, g2, c1); + + if (constraint.getWidthRange().contains(size1.getWidth())) { + return size1; + } + else { + double w = constraint.getWidthRange().constrain(size1.getWidth()); + RectangleConstraint c2 = constraint.toFixedWidth(w); + return arrange(container, g2, c2); + } + } + + /** + * Arrange with a fixed height and no width constraint. + * + * @param container the container. + * @param constraint the constraint. + * @param g2 the graphics device. + * + * @return The size of the arrangement. + */ + protected Size2D arrangeNR(BlockContainer container, Graphics2D g2, + RectangleConstraint constraint) { + + RectangleConstraint c1 = constraint.toUnconstrainedHeight(); + Size2D size1 = arrange(container, g2, c1); + + if (constraint.getHeightRange().contains(size1.getHeight())) { + return size1; + } + else { + double h = constraint.getHeightRange().constrain(size1.getHeight()); + RectangleConstraint c2 = constraint.toFixedHeight(h); + return arrange(container, g2, c2); + } + } + + /** + * Arrange with ranges for both the width and height constraints. + * + * @param container the container. + * @param constraint the constraint. + * @param g2 the graphics device. + * + * @return The size of the arrangement. + */ + protected Size2D arrangeRR(BlockContainer container, Graphics2D g2, + RectangleConstraint constraint) { + + Size2D size1 = arrange(container, g2, RectangleConstraint.NONE); + + if (constraint.getWidthRange().contains(size1.getWidth())) { + if (constraint.getHeightRange().contains(size1.getHeight())) { + return size1; + } + else { + // width is OK, but height must be constrained + double h = constraint.getHeightRange().constrain( + size1.getHeight()); + RectangleConstraint cc = new RectangleConstraint( + size1.getWidth(), h); + return arrangeFF(container, g2, cc); + } + } + else { + if (constraint.getHeightRange().contains(size1.getHeight())) { + // height is OK, but width must be constrained + double w = constraint.getWidthRange().constrain( + size1.getWidth()); + RectangleConstraint cc = new RectangleConstraint(w, + size1.getHeight()); + return arrangeFF(container, g2, cc); + + } + else { + double w = constraint.getWidthRange().constrain( + size1.getWidth()); + double h = constraint.getHeightRange().constrain( + size1.getHeight()); + RectangleConstraint cc = new RectangleConstraint(w, h); + return arrangeFF(container, g2, cc); + } + } + } + + /** * Arrange with a fixed width and a height within a given range. * * @param container the container. @@ -234,28 +361,61 @@ protected Size2D arrangeFN(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { - double width = constraint.getWidth() / this.columns; - RectangleConstraint constraint2 = constraint.toFixedWidth(width); + double width = constraint.getWidth() / this.columns; + RectangleConstraint bc = constraint.toFixedWidth(width); List blocks = container.getBlocks(); double maxH = 0.0; for (int r = 0; r < this.rows; r++) { for (int c = 0; c < this.columns; c++) { int index = r * this.columns + c; - if (index == blocks.size()) { + if (index >= blocks.size()) { break; } Block b = (Block) blocks.get(index); - Size2D s = b.arrange(g2, constraint2); - maxH = Math.max(maxH, s.getHeight()); + if (b != null) { + Size2D s = b.arrange(g2, bc); + maxH = Math.max(maxH, s.getHeight()); + } } } - RectangleConstraint constraint3 = constraint.toFixedHeight( - maxH * this.rows - ); - return arrange(container, g2, constraint3); + RectangleConstraint cc = constraint.toFixedHeight(maxH * this.rows); + return arrange(container, g2, cc); } /** + * Arrange with a fixed height and no constraint for the width. + * + * @param container the container. + * @param g2 the graphics device. + * @param constraint the constraint. + * + * @return The size of the arrangement. + */ + protected Size2D arrangeNF(BlockContainer container, Graphics2D g2, + RectangleConstraint constraint) { + + double height = constraint.getHeight() / this.rows; + RectangleConstraint bc = constraint.toFixedHeight(height); + List blocks = container.getBlocks(); + double maxW = 0.0; + for (int r = 0; r < this.rows; r++) { + for (int c = 0; c < this.columns; c++) { + int index = r * this.columns + c; + if (index >= blocks.size()) { + break; + } + Block b = (Block) blocks.get(index); + if (b != null) { + Size2D s = b.arrange(g2, bc); + maxW = Math.max(maxW, s.getWidth()); + } + } + } + RectangleConstraint cc = constraint.toFixedWidth(maxW * this.columns); + return arrange(container, g2, cc); + } + + /** * Clears any cached layout information retained by the arrangement. */ public void clear() { Modified: branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/block/junit/GridArrangementTests.java =================================================================== --- branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/block/junit/GridArrangementTests.java 2008-12-03 08:31:33 UTC (rev 1731) +++ branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/block/junit/GridArrangementTests.java 2008-12-03 08:35:07 UTC (rev 1732) @@ -35,6 +35,7 @@ * Changes * ------- * 08-Mar-2005 : Version 1 (DG); + * 03-Dec-2008 : Added more tests (DG); * */ @@ -57,6 +58,7 @@ import org.jfree.chart.block.GridArrangement; import org.jfree.chart.block.LengthConstraintType; import org.jfree.chart.block.RectangleConstraint; +import org.jfree.data.Range; import org.jfree.ui.Size2D; /** @@ -122,9 +124,8 @@ out.writeObject(f1); out.close(); - ObjectInput in = new ObjectInputStream( - new ByteArrayInputStream(buffer.toByteArray()) - ); + ObjectInput in = new ObjectInputStream(new ByteArrayInputStream( + buffer.toByteArray())); f2 = (GridArrangement) in.readObject(); in.close(); } @@ -147,19 +148,78 @@ } /** - * Test arrangement with no constraints. + * Test arrangement with a fixed width and no height constraint. */ public void testFN() { BlockContainer c = createTestContainer1(); - RectangleConstraint constraint = new RectangleConstraint( - 100.0, null, LengthConstraintType.FIXED, - 0.0, null, LengthConstraintType.NONE - ); + RectangleConstraint constraint = new RectangleConstraint(100.0, null, + LengthConstraintType.FIXED, 0.0, null, + LengthConstraintType.NONE); Size2D s = c.arrange(null, constraint); assertEquals(100.0, s.width, EPSILON); assertEquals(33.0, s.height, EPSILON); } + /** + * Test arrangement with a fixed height and no width constraint. + */ + public void testNF() { + BlockContainer c = createTestContainer1(); + RectangleConstraint constraint = RectangleConstraint.NONE.toFixedHeight( + 100.0); + Size2D s = c.arrange(null, constraint); + assertEquals(90.0, s.width, EPSILON); + assertEquals(100.0, s.height, EPSILON); + } + + /** + * Test arrangement with a range for the width and a fixed height. + */ + public void testRF() { + BlockContainer c = createTestContainer1(); + RectangleConstraint constraint = new RectangleConstraint(new Range(40.0, + 60.0), 100.0); + Size2D s = c.arrange(null, constraint); + assertEquals(60.0, s.width, EPSILON); + assertEquals(100.0, s.height, EPSILON); + } + + /** + * Test arrangement with a range for the width and height. + */ + public void testRR() { + BlockContainer c = createTestContainer1(); + RectangleConstraint constraint = new RectangleConstraint(new Range(40.0, + 60.0), new Range(50.0, 70.0)); + Size2D s = c.arrange(null, constraint); + assertEquals(60.0, s.width, EPSILON); + assertEquals(50.0, s.height, EPSILON); + } + + /** + * Test arrangement with a range for the width and no height constraint. + */ + public void testRN() { + BlockContainer c = createTestContainer1(); + RectangleConstraint constraint = RectangleConstraint.NONE.toRangeWidth( + new Range(40.0, 60.0)); + Size2D s = c.arrange(null, constraint); + assertEquals(60.0, s.width, EPSILON); + assertEquals(33.0, s.height, EPSILON); + } + + /** + * Test arrangement with a range for the height and no width constraint. + */ + public void testNR() { + BlockContainer c = createTestContainer1(); + RectangleConstraint constraint = RectangleConstraint.NONE.toRangeHeight( + new Range(40.0, 60.0)); + Size2D s = c.arrange(null, constraint); + assertEquals(90.0, s.width, EPSILON); + assertEquals(40.0, s.height, EPSILON); + } + private BlockContainer createTestContainer1() { Block b1 = new EmptyBlock(10, 11); Block b2 = new EmptyBlock(20, 22); @@ -171,4 +231,98 @@ return result; } + /** + * The arrangement should be able to handle null blocks in the layout. + */ + public void testNullBlock_FF() { + BlockContainer c = new BlockContainer(new GridArrangement(1, 1)); + c.add(null); + Size2D s = c.arrange(null, new RectangleConstraint(20, 10)); + assertEquals(20.0, s.getWidth(), EPSILON); + assertEquals(10.0, s.getHeight(), EPSILON); + } + + /** + * The arrangement should be able to handle null blocks in the layout. + */ + public void testNullBlock_FN() { + BlockContainer c = new BlockContainer(new GridArrangement(1, 1)); + c.add(null); + Size2D s = c.arrange(null, RectangleConstraint.NONE.toFixedWidth(10)); + assertEquals(10.0, s.getWidth(), EPSILON); + assertEquals(0.0, s.getHeight(), EPSILON); + } + + /** + * The arrangement should be able to handle null blocks in the layout. + */ + public void testNullBlock_FR() { + BlockContainer c = new BlockContainer(new GridArrangement(1, 1)); + c.add(null); + Size2D s = c.arrange(null, new RectangleConstraint(30.0, new Range(5.0, + 10.0))); + assertEquals(30.0, s.getWidth(), EPSILON); + assertEquals(5.0, s.getHeight(), EPSILON); + } + + /** + * The arrangement should be able to handle null blocks in the layout. + */ + public void testNullBlock_NN() { + BlockContainer c = new BlockContainer(new GridArrangement(1, 1)); + c.add(null); + Size2D s = c.arrange(null, RectangleConstraint.NONE); + assertEquals(0.0, s.getWidth(), EPSILON); + assertEquals(0.0, s.getHeight(), EPSILON); + } + + /** + * The arrangement should be able to handle less blocks than grid spaces. + */ + public void testGridNotFull_FF() { + Block b1 = new EmptyBlock(5, 5); + BlockContainer c = new BlockContainer(new GridArrangement(2, 3)); + c.add(b1); + Size2D s = c.arrange(null, new RectangleConstraint(200, 100)); + assertEquals(200.0, s.getWidth(), EPSILON); + assertEquals(100.0, s.getHeight(), EPSILON); + } + + /** + * The arrangement should be able to handle less blocks than grid spaces. + */ + public void testGridNotFull_FN() { + Block b1 = new EmptyBlock(5, 5); + BlockContainer c = new BlockContainer(new GridArrangement(2, 3)); + c.add(b1); + Size2D s = c.arrange(null, RectangleConstraint.NONE.toFixedWidth(30.0)); + assertEquals(30.0, s.getWidth(), EPSILON); + assertEquals(10.0, s.getHeight(), EPSILON); + } + + /** + * The arrangement should be able to handle less blocks than grid spaces. + */ + public void testGridNotFull_FR() { + Block b1 = new EmptyBlock(5, 5); + BlockContainer c = new BlockContainer(new GridArrangement(2, 3)); + c.add(b1); + Size2D s = c.arrange(null, new RectangleConstraint(30.0, new Range(5.0, + 10.0))); + assertEquals(30.0, s.getWidth(), EPSILON); + assertEquals(10.0, s.getHeight(), EPSILON); + } + + /** + * The arrangement should be able to handle less blocks than grid spaces. + */ + public void testGridNotFull_NN() { + Block b1 = new EmptyBlock(5, 5); + BlockContainer c = new BlockContainer(new GridArrangement(2, 3)); + c.add(b1); + Size2D s = c.arrange(null, RectangleConstraint.NONE); + assertEquals(15.0, s.getWidth(), EPSILON); + assertEquals(10.0, s.getHeight(), EPSILON); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-12-16 15:24:50
|
Revision: 1744 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1744&view=rev Author: mungady Date: 2008-12-16 15:24:45 +0000 (Tue, 16 Dec 2008) Log Message: ----------- Update for release. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/NEWS branches/jfreechart-1.0.x-branch/README.txt Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2008-12-16 15:11:52 UTC (rev 1743) +++ branches/jfreechart-1.0.x-branch/NEWS 2008-12-16 15:24:45 UTC (rev 1744) @@ -1,11 +1,29 @@ JFreeChart 1.0.12 ----------------- -?? ??? 2008 +19 December 2008 +This release adds support for minor tick marks, mapping datasets to more than +one axis, an important fix for the XYSeries class (relating to the +addOrUpdate() method) plus numerous other bug fixes. + +This release passes 1996 JUnit test (0 failures) on JRE 1.6.0_10. + +API Adjustments: +- CategoryPlot : added mapDatasetToDomainAxes() and mapDatasetToRangeAxes() + methods; +- Month : added a new constructor Month(Date, TimeZone, Locale) and deprecated + Month(Date, TimeZone); +- Quarter : added a new constructor Quarter(Date, TimeZone, Locale) and + deprecated Quarter(Date, TimeZone); +- XYPlot : added mapDatasetToDomainAxes() and mapDatasetToRangeAxes() methods; +- Year : added a new constructor Year(Date, TimeZone, Locale) and deprecated + Year(Date, TimeZone); + Bug Fixes: 2275695 : NullPointerException for SubCategoryAxis on plot with null dataset; 2221495 : XYLineAnnotation with dashed stroke; 2216511 : SWTBarChartDemo1 throws RuntimeException; +2201869 : DateAxis tick label position error; 2121818 : Label link lines for very thin RingPlot; 2113627 : XYStepRenderer item labels; 1955483 : XYSeries.addOrUpdate() problem. Modified: branches/jfreechart-1.0.x-branch/README.txt =================================================================== --- branches/jfreechart-1.0.x-branch/README.txt 2008-12-16 15:11:52 UTC (rev 1743) +++ branches/jfreechart-1.0.x-branch/README.txt 2008-12-16 15:24:45 UTC (rev 1744) @@ -1,8 +1,8 @@ ******************************** -* JFREECHART: Version 1.0.11 * +* JFREECHART: Version 1.0.12 * ******************************** -19 September 2008 +19 December 2008 (C)opyright 2000-2008, by Object Refinery Limited and Contributors. @@ -21,6 +21,9 @@ without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Please refer to the licence for details. +We are grateful to the many developers that have contributed to JFreeChart. +The contributors are listed below in section 10. + ------------------- 2. LATEST VERSION ------------------- @@ -35,7 +38,7 @@ 3. DOCUMENTATION ----------------- You can download installation instructions -(jfreechart-1.0.11-install.pdf) from the JFreeChart home +(jfreechart-1.0.12-install.pdf) from the JFreeChart home page or the project page on SourceForge. Further documentation for JFreeChart (the JFreeChart Developer Guide) is @@ -115,11 +118,10 @@ We read all questions posted in the forum, and respond to as many as we can in the time available. Unfortunately, there are too many questions to answer them all. - -If you need commercial support for JFreeChart, this is offered by -Object Refinery Limited: - http://www.object-refinery.com/jfreechart/support.html +Previously we offered commercial support options, but this has been +discontinued as there wasn't sufficient uptake to meet the cost of +providing this service. -------------------- 6. ANT BUILD SCRIPT @@ -141,7 +143,7 @@ generated is included in the JFreeChart distribution. To run the demo (using JDK 1.3.1 or later), use the following command: - java -jar jfreechart-1.0.11-demo.jar + java -jar jfreechart-1.0.12-demo.jar The complete source code for the demo application is available for download when you purchase the JFreeChart Developer Guide. @@ -176,23 +178,16 @@ If there are other items that you think should be listed here, please post a bug report. ------------------ -9. GNU CLASSPATH ------------------ -GNU Classpath is a project to create a free, clean-room implementation of the -standard Java(tm) class libraries: - -http://www.gnu.org/software/classpath/ - -JFreeChart should work quite well with free runtimes based on -GNU Classpath 0.92 or later. We are grateful to all the GNU Classpath -developers that have made this possible. - ---------------- -10. WHAT's NEW ---------------- +-------------- +9. WHAT's NEW +-------------- A list of changes in recent versions: +1.0.12 : (19-Dec-2008) + - added support for minor tick marks, mapping datasets to more than + one axis, and numerous bug fixes - see the NEWS and ChangeLog files + for details. + 1.0.11 : (18-Sep-2008) - this release includes a new chart theming mechanism, and numerous other feature enhancements and bug fixes - see the NEWS and ChangeLog This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-12-17 07:38:15
|
Revision: 1750 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1750&view=rev Author: mungady Date: 2008-12-17 07:38:11 +0000 (Wed, 17 Dec 2008) Log Message: ----------- 2008-12-17 David Gilbert <dav...@ob...> * source/org/jfree/chart/plot/PieLabelRecord.java (url): New field, (PieLabelRecord): Initialise new field, (getURL): New method, (setURL): New method, (equals): Updated for new field, * source/org/jfree/chart/plot/PiePlot.java (drawLeftLabels): Added URL to label entity, (drawRightLabels): Likewise. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PieLabelRecord.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PiePlot.java branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/PieLabelRecordTests.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2008-12-16 16:05:16 UTC (rev 1749) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2008-12-17 07:38:11 UTC (rev 1750) @@ -1,3 +1,15 @@ +2008-12-17 David Gilbert <dav...@ob...> + + * source/org/jfree/chart/plot/PieLabelRecord.java + (url): New field, + (PieLabelRecord): Initialise new field, + (getURL): New method, + (setURL): New method, + (equals): Updated for new field, + * source/org/jfree/chart/plot/PiePlot.java + (drawLeftLabels): Added URL to label entity, + (drawRightLabels): Likewise. + 2008-12-03 David Gilbert <dav...@ob...> * source/org/jfree/chart/block/GridArrangement.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PieLabelRecord.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PieLabelRecord.java 2008-12-16 16:05:16 UTC (rev 1749) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PieLabelRecord.java 2008-12-17 07:38:11 UTC (rev 1750) @@ -37,6 +37,7 @@ * 08-Mar-2004 : Version 1 (DG); * 14-Jun-2007 : Implemented Serializable, updated API docs (DG); * 21-Nov-2007 : Implemented equals() to shut up FindBugs (DG); + * 06-Nov-2008 : Added URL field (DG); * */ @@ -45,10 +46,12 @@ import java.io.Serializable; import org.jfree.text.TextBox; +import org.jfree.util.ObjectUtilities; /** * A structure that retains information about the label for a section in a pie - * chart. + * chart. Instances of this class are created temporarily during chart drawing + * only. */ public class PieLabelRecord implements Comparable, Serializable { @@ -77,6 +80,13 @@ private double linkPercent; /** + * The URL (<code>null</code> permitted). + * + * @since 1.0.12 + */ + private String url; + + /** * Creates a new record. * * @param key the section key. @@ -98,6 +108,7 @@ this.labelHeight = labelHeight; this.gap = gap; this.linkPercent = linkPercent; + this.url = null; } /** @@ -211,6 +222,29 @@ } /** + * Returns the URL associated with the section label. This is only used + * in HTML image maps. + * + * @return The URL (may be <code>null</code>). + * + * @since 1.0.12 + */ + public String getURL() { + return this.url; + } + + /** + * Sets the URL for the section label. + * + * @param url the URL (<code>null</code> permitted). + * + * @since 1.0.12 + */ + public void setURL(String url) { + this.url = url; + } + + /** * Compares this object to an arbitrary object. * * @param obj the object to compare against. @@ -270,6 +304,9 @@ if (!this.label.equals(that.label)) { return false; } + if (!ObjectUtilities.equal(this.url, that.url)) { + return false; + } return true; } Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PiePlot.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PiePlot.java 2008-12-16 16:05:16 UTC (rev 1749) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PiePlot.java 2008-12-17 07:38:11 UTC (rev 1750) @@ -2816,6 +2816,11 @@ String label = this.labelGenerator.generateSectionLabel( this.dataset, leftKeys.getKey(i)); if (label != null) { + String url = null; + if (this.urlGenerator != null) { + url = this.urlGenerator.generateURL(this.dataset, + leftKeys.getKey(i), this.pieIndex); + } TextBlock block = TextUtilities.createTextBlock(label, this.labelFont, this.labelPaint, maxLabelWidth, new G2TextMeasurer(g2)); @@ -2831,11 +2836,13 @@ * verticalLinkRadius; double hh = labelBox.getHeight(g2); - this.labelDistributor.addPieLabelRecord(new PieLabelRecord( + PieLabelRecord plr = new PieLabelRecord( leftKeys.getKey(i), theta, baseY, labelBox, hh, lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 1.0 - getLabelLinkDepth() - + getExplodePercent(leftKeys.getKey(i)))); + + getExplodePercent(leftKeys.getKey(i))); + plr.setURL(url); + this.labelDistributor.addPieLabelRecord(plr); } } double hh = plotArea.getHeight(); @@ -3065,7 +3072,14 @@ } TextBox tb = record.getLabel(); tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.RIGHT); - + if (record.getURL() != null) { + EntityCollection entities = state.getEntityCollection(); + if (entities != null) { +// // add an entity for the label +// Rectangle2D bounds = tb.g +// TickLabelEntity tle = new TickLabelEntity(); + } + } } /** Modified: branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/PieLabelRecordTests.java =================================================================== --- branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/PieLabelRecordTests.java 2008-12-16 16:05:16 UTC (rev 1749) +++ branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/PieLabelRecordTests.java 2008-12-17 07:38:11 UTC (rev 1750) @@ -51,12 +51,11 @@ import junit.framework.TestCase; import junit.framework.TestSuite; -import org.jfree.chart.plot.CategoryMarker; import org.jfree.chart.plot.PieLabelRecord; import org.jfree.text.TextBox; /** - * Some tests for the {@link CategoryMarker} class. + * Some tests for the {@link PieLabelRecord} class. */ public class PieLabelRecordTests extends TestCase { @@ -124,6 +123,10 @@ p2 = new PieLabelRecord("B", 1.1, 2.2, new TextBox("C"), 3.3, 4.4, 5.5); assertTrue(p1.equals(p2)); + p1.setURL("ABC"); + assertFalse(p1.equals(p2)); + p2.setURL("ABC"); + assertTrue(p1.equals(p2)); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-12-17 07:49:33
|
Revision: 1751 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1751&view=rev Author: mungady Date: 2008-12-17 07:49:28 +0000 (Wed, 17 Dec 2008) Log Message: ----------- Reverting previous change. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PieLabelRecord.java branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PiePlot.java branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/PieLabelRecordTests.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2008-12-17 07:38:11 UTC (rev 1750) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2008-12-17 07:49:28 UTC (rev 1751) @@ -1,15 +1,3 @@ -2008-12-17 David Gilbert <dav...@ob...> - - * source/org/jfree/chart/plot/PieLabelRecord.java - (url): New field, - (PieLabelRecord): Initialise new field, - (getURL): New method, - (setURL): New method, - (equals): Updated for new field, - * source/org/jfree/chart/plot/PiePlot.java - (drawLeftLabels): Added URL to label entity, - (drawRightLabels): Likewise. - 2008-12-03 David Gilbert <dav...@ob...> * source/org/jfree/chart/block/GridArrangement.java Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PieLabelRecord.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PieLabelRecord.java 2008-12-17 07:38:11 UTC (rev 1750) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PieLabelRecord.java 2008-12-17 07:49:28 UTC (rev 1751) @@ -37,7 +37,6 @@ * 08-Mar-2004 : Version 1 (DG); * 14-Jun-2007 : Implemented Serializable, updated API docs (DG); * 21-Nov-2007 : Implemented equals() to shut up FindBugs (DG); - * 06-Nov-2008 : Added URL field (DG); * */ @@ -46,12 +45,10 @@ import java.io.Serializable; import org.jfree.text.TextBox; -import org.jfree.util.ObjectUtilities; /** * A structure that retains information about the label for a section in a pie - * chart. Instances of this class are created temporarily during chart drawing - * only. + * chart. */ public class PieLabelRecord implements Comparable, Serializable { @@ -80,13 +77,6 @@ private double linkPercent; /** - * The URL (<code>null</code> permitted). - * - * @since 1.0.12 - */ - private String url; - - /** * Creates a new record. * * @param key the section key. @@ -108,7 +98,6 @@ this.labelHeight = labelHeight; this.gap = gap; this.linkPercent = linkPercent; - this.url = null; } /** @@ -222,29 +211,6 @@ } /** - * Returns the URL associated with the section label. This is only used - * in HTML image maps. - * - * @return The URL (may be <code>null</code>). - * - * @since 1.0.12 - */ - public String getURL() { - return this.url; - } - - /** - * Sets the URL for the section label. - * - * @param url the URL (<code>null</code> permitted). - * - * @since 1.0.12 - */ - public void setURL(String url) { - this.url = url; - } - - /** * Compares this object to an arbitrary object. * * @param obj the object to compare against. @@ -304,9 +270,6 @@ if (!this.label.equals(that.label)) { return false; } - if (!ObjectUtilities.equal(this.url, that.url)) { - return false; - } return true; } Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PiePlot.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PiePlot.java 2008-12-17 07:38:11 UTC (rev 1750) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/plot/PiePlot.java 2008-12-17 07:49:28 UTC (rev 1751) @@ -2816,11 +2816,6 @@ String label = this.labelGenerator.generateSectionLabel( this.dataset, leftKeys.getKey(i)); if (label != null) { - String url = null; - if (this.urlGenerator != null) { - url = this.urlGenerator.generateURL(this.dataset, - leftKeys.getKey(i), this.pieIndex); - } TextBlock block = TextUtilities.createTextBlock(label, this.labelFont, this.labelPaint, maxLabelWidth, new G2TextMeasurer(g2)); @@ -2836,13 +2831,11 @@ * verticalLinkRadius; double hh = labelBox.getHeight(g2); - PieLabelRecord plr = new PieLabelRecord( + this.labelDistributor.addPieLabelRecord(new PieLabelRecord( leftKeys.getKey(i), theta, baseY, labelBox, hh, lGap / 2.0 + lGap / 2.0 * -Math.cos(theta), 1.0 - getLabelLinkDepth() - + getExplodePercent(leftKeys.getKey(i))); - plr.setURL(url); - this.labelDistributor.addPieLabelRecord(plr); + + getExplodePercent(leftKeys.getKey(i)))); } } double hh = plotArea.getHeight(); @@ -3072,14 +3065,7 @@ } TextBox tb = record.getLabel(); tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.RIGHT); - if (record.getURL() != null) { - EntityCollection entities = state.getEntityCollection(); - if (entities != null) { -// // add an entity for the label -// Rectangle2D bounds = tb.g -// TickLabelEntity tle = new TickLabelEntity(); - } - } + } /** Modified: branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/PieLabelRecordTests.java =================================================================== --- branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/PieLabelRecordTests.java 2008-12-17 07:38:11 UTC (rev 1750) +++ branches/jfreechart-1.0.x-branch/tests/org/jfree/chart/plot/junit/PieLabelRecordTests.java 2008-12-17 07:49:28 UTC (rev 1751) @@ -51,11 +51,12 @@ import junit.framework.TestCase; import junit.framework.TestSuite; +import org.jfree.chart.plot.CategoryMarker; import org.jfree.chart.plot.PieLabelRecord; import org.jfree.text.TextBox; /** - * Some tests for the {@link PieLabelRecord} class. + * Some tests for the {@link CategoryMarker} class. */ public class PieLabelRecordTests extends TestCase { @@ -123,10 +124,6 @@ p2 = new PieLabelRecord("B", 1.1, 2.2, new TextBox("C"), 3.3, 4.4, 5.5); assertTrue(p1.equals(p2)); - p1.setURL("ABC"); - assertFalse(p1.equals(p2)); - p2.setURL("ABC"); - assertTrue(p1.equals(p2)); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mu...@us...> - 2008-12-20 08:19:33
|
Revision: 1759 http://jfreechart.svn.sourceforge.net/jfreechart/?rev=1759&view=rev Author: mungady Date: 2008-12-20 08:19:29 +0000 (Sat, 20 Dec 2008) Log Message: ----------- 2008-12-20 David Gilbert <dav...@ob...> Bug 2452078: * source/org/jfree/chart/ChartFactory.java (createStackedAreaChart): Set category margin to zero. Modified Paths: -------------- branches/jfreechart-1.0.x-branch/ChangeLog branches/jfreechart-1.0.x-branch/NEWS branches/jfreechart-1.0.x-branch/source/org/jfree/chart/ChartFactory.java Modified: branches/jfreechart-1.0.x-branch/ChangeLog =================================================================== --- branches/jfreechart-1.0.x-branch/ChangeLog 2008-12-19 13:53:54 UTC (rev 1758) +++ branches/jfreechart-1.0.x-branch/ChangeLog 2008-12-20 08:19:29 UTC (rev 1759) @@ -1,3 +1,9 @@ +2008-12-20 David Gilbert <dav...@ob...> + + Bug 2452078: + * source/org/jfree/chart/ChartFactory.java + (createStackedAreaChart): Set category margin to zero. + 2008-12-18 David Gilbert <dav...@ob...> Patch 1607918 by Jess Thrysoee (with modifications): Modified: branches/jfreechart-1.0.x-branch/NEWS =================================================================== --- branches/jfreechart-1.0.x-branch/NEWS 2008-12-19 13:53:54 UTC (rev 1758) +++ branches/jfreechart-1.0.x-branch/NEWS 2008-12-20 08:19:29 UTC (rev 1759) @@ -20,6 +20,7 @@ Year(Date, TimeZone); Bug Fixes: +2452078 : StackedAreaChart has gaps; 2275695 : NullPointerException for SubCategoryAxis on plot with null dataset; 2221495 : XYLineAnnotation with dashed stroke; 2216511 : SWTBarChartDemo1 throws RuntimeException; Modified: branches/jfreechart-1.0.x-branch/source/org/jfree/chart/ChartFactory.java =================================================================== --- branches/jfreechart-1.0.x-branch/source/org/jfree/chart/ChartFactory.java 2008-12-19 13:53:54 UTC (rev 1758) +++ branches/jfreechart-1.0.x-branch/source/org/jfree/chart/ChartFactory.java 2008-12-20 08:19:29 UTC (rev 1759) @@ -118,6 +118,7 @@ * 14-Aug-2008 : Added ChartTheme facility (DG); * 23-Oct-2008 : Check for legacy theme in setChartTheme() and reset default * bar painters (DG); + * 20-Dec-2008 : In createStackedAreaChart(), set category margin to 0.0 (DG); * */ @@ -1160,18 +1161,15 @@ * @return A stacked area chart. */ public static JFreeChart createStackedAreaChart(String title, - String categoryAxisLabel, - String valueAxisLabel, - CategoryDataset dataset, - PlotOrientation orientation, - boolean legend, - boolean tooltips, - boolean urls) { + String categoryAxisLabel, String valueAxisLabel, + CategoryDataset dataset, PlotOrientation orientation, + boolean legend, boolean tooltips, boolean urls) { if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel); + categoryAxis.setCategoryMargin(0.0); ValueAxis valueAxis = new NumberAxis(valueAxisLabel); StackedAreaRenderer renderer = new StackedAreaRenderer(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |