From: SourceForge.net <no...@so...> - 2008-07-08 23:13:24
|
Bugs item #1225830, was opened at 2005-06-22 23:11 Message generated for change (Comment added) made by hontvari You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=115494&aid=1225830&group_id=15494 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: David Basten (bastend) Assigned to: Nobody/Anonymous (nobody) Summary: XYPlot Rendering Order Changes Break Stacked XY Charts Initial Comment: Somewhere between 1.0.0 PRE1 and 1.0.0 RC1 XYPlot was updated to set a rendering order: /** * The order of the series rendering (REVERSE draws the primary series * last so that it appears to be on top). */ private SeriesRenderingOrder seriesRenderingOrder = SeriesRenderingOrder.REVERSE; The default actually breaks the building of Stacked Area Charts. In the draw(...) method of StackedXYAreaRenderer.java, there is the following code: if (series != 0) { Stack points = areaState.getLastSeriesPoints(); while (!points.empty()) { Point point = (Point) points.pop(); areaState.getSeriesArea().addPoint( (int) point.getX(), (int) point.getY() ); } } The problem first manifested itself with a NullPointerException in the same chunk of code, but the initialization of the object did not solve the problem. When the series are run in reverse (decreasing) order, the "last points" are only populated on the last dataset, which results in incorrect charts. Setting the seriesRenderingOrder property on XYPlot solved the problem. Examples: goodStackLine.png -- showing correct output badStackLine.png -- showing incorrect output Also, while fixing this, I would also check out the horizontal chart layout. A little earlier in the draw method is the following code used to set up the "previous points": if (orientation == PlotOrientation.VERTICAL) { Point point = new Point((int) transX1, (int) transY1); areaState.getSeriesArea().addPoint( (int) point.getX(), (int) point.getY() ); areaState.getCurrentSeriesPoints().push(point); } else if (orientation == PlotOrientation.HORIZONTAL) { areaState.getSeriesArea().addPoint( (int) transY1, (int) transX1 ); } If it is a horizontal chart, the points are updated properly, but on horizontal charts, they are not. Regards, David ---------------------------------------------------------------------- Comment By: hontvari (hontvari) Date: 2008-07-09 01:13 Message: Logged In: YES user_id=880530 Originator: NO David, thank you for your investigation. I had stuck with 0.9.21 for about 2 years because of this. (I know, your bug report is 3 years old, but I haven't noticed it). I confirm that stacked charts indeed doesn't work and the workaround David sent does solve the first problem. To be clear, you have to write this: plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD); ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=115494&aid=1225830&group_id=15494 |